How to Request the Most Recent Record from the Database
Hi!
I am trying to return the most recent record from my database by sorting with _updatedAt and putting a limit of 1. I am not sure I have the correct syntax.
I am placing the javascript below in the where clause of the database request. It does not seem to function.
Any thoughts on how to get this working?
codereturn '{ $and:[ {"owner":"'+value+'"}, {"sort":"-_updatedAt"}, {"limit":"1"} ] }'; /code
Thanks!