From 00dad8d0fbc405048385ffc7163092c4283e2c3b Mon Sep 17 00:00:00 2001 From: Robin Heggelund Hansen Date: Thu, 7 Aug 2014 01:23:30 +0200 Subject: [PATCH] Allow object-id to convert string to object-id --- src/clojure/monger/util.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clojure/monger/util.clj b/src/clojure/monger/util.clj index a699a2d..b6c4d45 100644 --- a/src/clojure/monger/util.clj +++ b/src/clojure/monger/util.clj @@ -30,9 +30,11 @@ (.toString (new BigInteger n (SecureRandom.)) num-base)) (defn ^ObjectId object-id - "Returns a new BSON object id" - [] - (ObjectId.)) + "Returns a new BSON object id, or converts str to BSON object id" + ([] + (ObjectId.)) + ([s] + (ObjectId. s))) (defprotocol GetDocumentId (get-id [input] "Returns document id"))