How to get latest document of the same object based on a property

Greetings!

We have a requirement where daily report of a same object (say campaign) is being saved to the couchbase as a separate document . We need to get the last/latest document of a given object.

  • Latest record is decided based on the property say “revision” which is numeric and .
  • Gets incremented for every new report
  • Filtering would be done with few more parameters.

How do I get the report which has the latest revision? Any thoughts?

Thanks

1 Like