Merge pull request #86 from Skinney/object-id-str
Allow object-id to convert string to object-id
This commit is contained in:
commit
ea158554fc
1 changed files with 5 additions and 3 deletions
|
|
@ -30,9 +30,11 @@
|
||||||
(.toString (new BigInteger n (SecureRandom.)) num-base))
|
(.toString (new BigInteger n (SecureRandom.)) num-base))
|
||||||
|
|
||||||
(defn ^ObjectId object-id
|
(defn ^ObjectId object-id
|
||||||
"Returns a new BSON object id"
|
"Returns a new BSON object id, or converts str to BSON object id"
|
||||||
[]
|
([]
|
||||||
(ObjectId.))
|
(ObjectId.))
|
||||||
|
([s]
|
||||||
|
(ObjectId. s)))
|
||||||
|
|
||||||
(defprotocol GetDocumentId
|
(defprotocol GetDocumentId
|
||||||
(get-id [input] "Returns document id"))
|
(get-id [input] "Returns document id"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue