Ditto for monger.collection/exists?, /drop-index and /drop-indexes

This commit is contained in:
Michael S. Klishin 2012-01-29 07:38:28 +04:00
parent 025e8fce45
commit b30071a2b3

View file

@ -387,14 +387,19 @@
(defn drop-index (defn drop-index
"Drops an index from this collection." "Drops an index from this collection."
[^String collection, ^String name] ([^String collection ^String name]
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)] (let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
(.dropIndex coll name))) (.dropIndex coll name)))
([^DB db ^String collection ^String name]
(let [^DBCollection coll (.getCollection db collection)]
(.dropIndex coll name))))
(defn drop-indexes (defn drop-indexes
"Drops an indices from this collection." "Drops an indices from this collection."
[^String collection] ([^String collection]
(.dropIndexes ^DBCollection (.getCollection monger.core/*mongodb-database* collection))) (.dropIndexes ^DBCollection (.getCollection monger.core/*mongodb-database* collection)))
([^DB db ^String collection]
(.dropIndexes ^DBCollection (.getCollection db collection))))
;; ;;
@ -409,8 +414,10 @@
(monger.collection/exists? \"coll\") (monger.collection/exists? \"coll\")
" "
[^String collection] ([^String collection]
(.collectionExists monger.core/*mongodb-database* collection)) (.collectionExists monger.core/*mongodb-database* collection))
([^DB db ^String collection]
(.collectionExists db collection)))
(defn create (defn create
"Creates a collection with a given name and options." "Creates a collection with a given name and options."