Created
January 5, 2017 09:59
-
-
Save lilongen/5fcb1fce087c8ba514d826c50c4c038d to your computer and use it in GitHub Desktop.
mongo-date-range-query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var objIdMin = ObjectId(Math.floor((new Date('1990/10/10'))/1000).toString(16) + "0000000000000000") | |
var objIdMax = ObjectId(Math.floor((new Date('2011/10/10'))/1000).toString(16) + "0000000000000000") | |
db.myCollection.find({_id:{$gt: objIdMin, $lt: objIdMax}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment