From d337cd154665aecb06dfb03712403a73a1aebb7a Mon Sep 17 00:00:00 2001 From: Joshua Karstendick Date: Tue, 23 Jun 2015 17:21:05 -0400 Subject: [PATCH 1/2] added failing unit test --- test/monger/test/indexing_test.clj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/monger/test/indexing_test.clj b/test/monger/test/indexing_test.clj index 1c591a4..7211182 100644 --- a/test/monger/test/indexing_test.clj +++ b/test/monger/test/indexing_test.clj @@ -26,6 +26,8 @@ (mc/ensure-index db collection (array-map "language" 1)) (mc/drop-indexes db collection) (mc/ensure-index db collection (array-map "language" 1) {:unique true}) + (mc/drop-indexes db collection) + (mc/ensure-index db collection (array-map "language" 1) "index-name" true) (mc/drop-indexes db collection))) (deftest ^{:indexing true :time-consuming true} test-ttl-collections From 9c0f385ab206703a9bad345b8401519bd23a4176 Mon Sep 17 00:00:00 2001 From: Joshua Karstendick Date: Tue, 23 Jun 2015 17:21:12 -0400 Subject: [PATCH 2/2] Fixes a bug with the 5-arity ensure-index function. The argument named `name` shadowed clojure.core/name, so trying to call `name` as a function on line 426 throws an exception. Fixes the bug by renaming the argument to `index-name`. --- src/clojure/monger/collection.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/clojure/monger/collection.clj b/src/clojure/monger/collection.clj index 8569576..59ff4b0 100644 --- a/src/clojure/monger/collection.clj +++ b/src/clojure/monger/collection.clj @@ -422,10 +422,10 @@ (.createIndex (.getCollection db (name coll)) (as-field-selector keys) (to-db-object options))) - ([^DB db ^String coll ^Map keys ^String name unique?] + ([^DB db ^String coll ^Map keys ^String index-name unique?] (.createIndex (.getCollection db (name coll)) (as-field-selector keys) - name + index-name unique?)))