From e04c694e3c094537c03d372e91a318cf2bf51ff5 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sat, 10 May 2014 16:35:58 -0400 Subject: [PATCH] monger.core/authenticate should not require a connection --- src/clojure/monger/core.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clojure/monger/core.clj b/src/clojure/monger/core.clj index 1bc1b5d..74c264e 100644 --- a/src/clojure/monger/core.clj +++ b/src/clojure/monger/core.clj @@ -148,7 +148,7 @@ (defn authenticate - ([^MongoClient connection ^DB db ^String username ^chars password] + ([^DB db ^String username ^chars password] (try (.authenticate db username password) ;; MongoDB Java driver's exception hierarchy is a little crazy @@ -167,7 +167,7 @@ user (.getUsername uri) pwd (.getPassword uri)] (when (and user pwd) - (when-not (authenticate conn db user pwd) + (when-not (authenticate db user pwd) (throw (IllegalArgumentException. (format "Could not authenticate with MongoDB. Either database name or credentials are invalid. Database name: %s, username: %s" (.getName db) user))))) {:conn conn :db db}))