Data in MongoDB collection has format
{ "_id" : ObjectId("57a1bfc103c8851a98dba3b2"), "createdOn": NumberLong("1470218177561"), "name": "Raja", "description": "Employee Raja" }
Mongo DB Query and Results
> new Date(1470218177561);
ISODate("2016-08-03T09:56:17.561Z")
> new Date(1888888888888);
ISODate("2029-11-09T03:21:28.888Z")
> db.employee.find("{createdOn: { $lt: new Date(NumberLong(1888888888888)) }}");
The last query returns no result without any errors, so I can't determine what is wrong with my query.
Basically, want to find the records for the last 5 days with `$lt operator in Jongo. Tried the next query, but it also not working
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -5);
Date dateBefore = cal.getTime();
collection.find("{createdOn: {$gte : #}}", dateBefore).as(type);
Thanks.