From 525cf985c176fd028159c943c4a4586924a662a9 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Tue, 24 Feb 2015 08:34:38 +0300 Subject: [PATCH] Explain that this crap hasn't originated in Monger We have to cope with the retarded API in MongoDB server and Java driver 2.x. 3.0 is much more sensible, by the way. --- src/clojure/monger/result.clj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/clojure/monger/result.clj b/src/clojure/monger/result.clj index 9b5ae74..d77385c 100644 --- a/src/clojure/monger/result.clj +++ b/src/clojure/monger/result.clj @@ -27,6 +27,8 @@ ;; (defn- okayish? + "MongoDB protocol seem to be using 4 distinct values to indicate logical truth. + This function makes dealing with that slightly more manageable." [value] (contains? #{true "true" 1 1.0} value)) @@ -47,7 +49,7 @@ (okayish? (.get result "ok"))) (has-error? [^DBObject result] - ;; yes, this is exactly the logic MongoDB Java driver uses. + ;; yes, really. This is exactly the logic MongoDB Java driver uses. (> (count (str (.get result "err"))) 0)) (updated-existing? [^DBObject result]