Created
January 20, 2012 12:56
-
-
Save claj/1647271 to your computer and use it in GitHub Desktop.
create mongoId
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
(ns testoi) | |
;; http://api.mongodb.org/java/2.6.3/org/bson/types/ObjectId.html | |
testoi> (import 'org.bson.types.ObjectId) | |
org.bson.types.ObjectId | |
testoi> (ObjectId. "d1700430f92f194fad7ce85a") | |
#<ObjectId d1700430f92f194fad7ce85a> | |
;;massageToObjectId seems to be more allowing on what it receives, but still picky | |
testoi> (ObjectId/massageToObjectId "d1700430f92f194fad7ce85a") | |
#<ObjectId d1700430f92f194fad7ce85a> | |
testoi> (ObjectId/massageToObjectId "aaaabbbbccccddddeeeeffff0000") | |
nil | |
;; because this is not valid according to the oi schema | |
;; A globally unique identifier for objects. | |
;; Consists of 12 bytes, divided as follows: | |
;; 0-3 time (4b) | |
;; 4-5 machine | |
;; 7-8 pid | |
;; 9-11 inc | |
;;or something. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment