I have an auditing filed for all of my entities:
createDate
updateDate
I always initialize createDate
during the entity creation but updateDate
can contain NULL
until the first update.
I have to implement sorting feature over these fields.
With createDate
everything works fine but with updateDate
I have issues.
In case of a mixed set of NULLs and Dates in updateDate
during the descending sort, I have the NULLs first and this is not the something I'm expecting here.
I understand that according to the Neo4j documentation, this is an expecting behavior - When sorting the result set, null will always come at the end of the result set for ascending sorting, and first when doing descending sort. but I don't know right now how to implement the proper sorting from the user perspective where the user will see the latest updated documents at the top of the list. Some time ago I have even created GitHub issue for this feature https://github.com/opencypher/openCypher/issues/238
One workaround I can see here - is to populate also updateDate
together with createDate
during the entity creation but I really hate this solution.
Are there any other solutions in order to properly implement this task?