Closed atulmy closed 4 years ago
I am new using this library. I have an example where dates are working as expected:
This filters the objects properly:
db.find({ date: { $gte: new Date('2004-05-21T09:00:00.000+0000') } }).exec(function (err, docs) {});
This sorts all objects as expected:
db.find({}).sort({ date: 1 }).exec(function (err, docs) {});
This inverts the sorting:
db.find({}).sort({ date: -1 }).exec(function (err, docs) {});
@nuvolarmobileteam not sure, I tried same and it did not sort properly. I resorted to saving date in unix timestamp as integer.
For now I would advise you to look for this problem in the nedb library, this package is a clone of it.
Looks like Date() is the way to go: https://github.com/louischatriot/nedb/issues/383
Does it mean these operators will not work with
Date
field?Also
sort
on field with typeDate
does not seem to work.