Filtering & sorting by dates in MongoDB's oplog -
i'm trying filter oplog.rs view operations logged after date. comparison operators don't seem work dates in mongodb:
db['oplog.rs'].find({ts: {$gte: isodate("2014-12-15t00:00:00z")}})
what's confusing lot of online sources saying way not working. want return results ts field @ least december 15th or more recent, getting results before period. if switch $gte $lte no results @ displayed, though there entries both before , after specified date.
also, can't seem sort results either. if try this:
db['oplog.rs'].find().sort({ts: -1})
i this:
error: { "$err" : "runner error: overflow sort stage buffered data usage of 33566005 bytes exceeds internal limit of 33554432 bytes", "code" : 17144 }
if filter results make them more recent, hoping overcome sorting error, can't mongodb's basic operators. how can filter results of find operation date?
comparion operators work fine date, ts
timestamp object - not date.
your query needs this:
db['oplog.rs'].find({ts: {$gte: timestamp(isodate("2014-12-15t00:00:00z").gettime(),0)}})
this creates timestamp object based on isodate , uses in query.
Comments
Post a Comment