How to GET last dates within a certain constraint

68 views Asked by At

I am trying to figure out how I can pull records from a mongo database using Jongo that will check the date that is on the object in the db and will only return an object with the data from, in my case, the last three most current dates. I'm using LocalDate to set the date on the object.

So that's the problem, what I'm doing is I have an angularjs web ui that interfaces with a java backend and I'm trying to scale down my scope, because the current way I'm displaying data is not feasibly scalable. So I want to limit the response I receive to the last 3 objects created instead of all of the objects. And I'm to the point where I need to do a check on the date but I can't seem to find a reasonable solution. isAfter() and isBefore() was where I started my initial effort, but I can't guarantee the dates in any way so I don't know where to set my constraints.

The code I'm working on doesn't really matter, I'm just more interested in how I can do the check in general.

Thanks in advance for any help, if any at all, can be offered!

0

There are 0 answers