Add extra arities to several update functions
This commit is contained in:
parent
37e8df8300
commit
9752950d82
1 changed files with 30 additions and 24 deletions
|
|
@ -352,7 +352,9 @@
|
|||
(monger.collection/update db \"people\" {:first_name \"Yoko\"} {:first_name \"Yoko\" :last_name \"Ono\"} {:upsert true)
|
||||
|
||||
By default :upsert and :multi are false."
|
||||
[^DB db ^String coll ^Map conditions ^Map document {:keys [upsert multi write-concern]
|
||||
([^DB db ^String coll ^Map conditions ^Map document]
|
||||
(update db coll conditions document {}))
|
||||
([^DB db ^String coll ^Map conditions ^Map document {:keys [upsert multi write-concern]
|
||||
:or {upsert false
|
||||
multi false
|
||||
write-concern monger.core/*mongodb-write-concern*}}]
|
||||
|
|
@ -361,7 +363,7 @@
|
|||
(to-db-object document)
|
||||
upsert
|
||||
multi
|
||||
write-concern))
|
||||
write-concern)))
|
||||
|
||||
(defn ^WriteResult upsert
|
||||
"Performs an upsert.
|
||||
|
|
@ -370,14 +372,18 @@
|
|||
sets :upsert to true.
|
||||
|
||||
See monger.collection/update documentation"
|
||||
[^DB db ^String coll ^Map conditions ^Map document {:keys [multi write-concern]
|
||||
([^DB db ^String coll ^Map conditions ^Map document]
|
||||
(upsert db coll conditions document {}))
|
||||
([^DB db ^String coll ^Map conditions ^Map document {:keys [multi write-concern]
|
||||
:or {multi false
|
||||
write-concern monger.core/*mongodb-write-concern*}}]
|
||||
(update db coll conditions document {:multi multi :write-concern write-concern :upsert true}))
|
||||
(update db coll conditions document {:multi multi :write-concern write-concern :upsert true})))
|
||||
|
||||
(defn ^WriteResult update-by-id
|
||||
"Update a document with given id"
|
||||
[^DB db ^String coll id ^Map document {:keys [upsert write-concern]
|
||||
([^DB db ^String coll id ^Map document]
|
||||
(update-by-id db coll id document {}))
|
||||
([^DB db ^String coll id ^Map document {:keys [upsert write-concern]
|
||||
:or {upsert false
|
||||
write-concern monger.core/*mongodb-write-concern*}}]
|
||||
(check-not-nil! id "id must not be nil")
|
||||
|
|
@ -386,7 +392,7 @@
|
|||
(to-db-object document)
|
||||
upsert
|
||||
false
|
||||
write-concern))
|
||||
write-concern)))
|
||||
|
||||
|
||||
;; monger.collection/save
|
||||
|
|
|
|||
Loading…
Reference in a new issue