Created
August 12, 2010 16:28
-
-
Save jcsalterego/521236 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| > now = new Date() | |
| "Thu Aug 12 2010 11:24:42 GMT-0500 (CDT)" | |
| > now.getTime() | |
| 1281630282255 | |
| > db.foo.drop() | |
| true | |
| > db.foo.insert({datetime:now}) | |
| > next = new Date(now.getTime() + 1000) | |
| "Thu Aug 12 2010 11:24:43 GMT-0500 (CDT)" | |
| > db.foo.insert({datetime:next}) | |
| > db.foo.find({datetime:{$gt:now}}) // should return 'next' | |
| { "_id" : ObjectId("4c64208aca1e130036da36a9"), "datetime" : "Thu Aug 12 2010 11:24:43 GMT-0500 (CDT)" } | |
| > db.foo.find({datetime:{$lt:next}}) // should return 'now' | |
| { "_id" : ObjectId("4c64205dca1e130036da36a8"), "datetime" : "Thu Aug 12 2010 11:24:42 GMT-0500 (CDT)" } | |
| > db.foo.find({datetime:{$gte:now}}) // should return both | |
| { "_id" : ObjectId("4c64205dca1e130036da36a8"), "datetime" : "Thu Aug 12 2010 11:24:42 GMT-0500 (CDT)" } | |
| { "_id" : ObjectId("4c64208aca1e130036da36a9"), "datetime" : "Thu Aug 12 2010 11:24:43 GMT-0500 (CDT)" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment