Ditto for monger.collection/save
This commit is contained in:
parent
afa516fff6
commit
b76cffcd1a
2 changed files with 6 additions and 3 deletions
|
|
@ -290,11 +290,14 @@
|
|||
|
||||
(monger.collection/save \"people\" { :first_name \"Ian\" :last_name \"Gillan\" })
|
||||
"
|
||||
([^String collection, ^Map document]
|
||||
([^String collection ^Map document]
|
||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
|
||||
(.save coll (to-db-object document) monger.core/*mongodb-write-concern*)))
|
||||
([^String collection, ^Map document, ^WriteConcern write-concern]
|
||||
([^String collection ^Map document ^WriteConcern write-concern]
|
||||
(let [^DBCollection coll (.getCollection monger.core/*mongodb-database* collection)]
|
||||
(.save coll document write-concern)))
|
||||
([^DB db ^String collection ^Map document ^WriteConcern write-concern]
|
||||
(let [^DBCollection coll (.getCollection db collection)]
|
||||
(.save coll document write-concern))))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@
|
|||
(let [collection "people"
|
||||
doc (mgcnv/to-db-object { :name "Joe", :age 30 })]
|
||||
(is (nil? (monger.util/get-id doc)))
|
||||
(mgcol/save "people" doc)
|
||||
(mgcol/save monger.core/*mongodb-database* "people" doc WriteConcern/SAFE)
|
||||
(is (not (nil? (monger.util/get-id doc))))))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue