Created
December 18, 2014 12:49
-
-
Save comerford/dfa733ac46d564cb2580 to your computer and use it in GitHub Desktop.
Testing ObjectId Snippet
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
// start a mongo shell to act as a JS interpreter (no db connection required) | |
mongo --nodb | |
// store sample id in a variable | |
var id = new ObjectId("533bc0f60015a0a814000001"); | |
// print out the variable | |
> id | |
ObjectId("533bc0f60015a0a814000001") | |
// try some methods | |
id.getTimestamp() | |
ISODate("2014-04-02T07:49:10Z") | |
id.getTimestamp().getTime() | |
1396424950000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment