Merge branch 'master' of github.com:michaelklishin/monger

This commit is contained in:
Michael Klishin 2012-12-04 13:06:52 +04:00
commit 4182a2ab8e

View file

@ -606,7 +606,19 @@
(.collectionExists db 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.
Options are:
:capped (pass true to create a capped collection)
:max (number of documents)
:size (max allowed size of the collection, in bytes)
EXAMPLE:
;; create a capped collection
(monger.collection/create \"coll\" {:capped true :size 100000 :max 10})
"
([^String collection ^Map options] ([^String collection ^Map options]
(.createCollection monger.core/*mongodb-database* collection (to-db-object options))) (.createCollection monger.core/*mongodb-database* collection (to-db-object options)))
([^DB db ^String collection ^Map options] ([^DB db ^String collection ^Map options]
@ -666,16 +678,6 @@
(.distinct (.getCollection db (name collection)) ^String (to-db-object key) (to-db-object query)))) (.distinct (.getCollection db (name collection)) ^String (to-db-object key) (to-db-object query))))
;;
;; create/capped collections
;;
(defn create
"Creates a collection. Options are: :capped (pass true to create a capped collection), :max (number of documents)
and :size (max allowed size of the collection, in bytes)."
[^String collection options]
(.createCollection ^DB monger.core/*mongodb-database* collection (to-db-object options)))
;; ;;
;; Aggregation ;; Aggregation
;; ;;