One more test to serve as example

This commit is contained in:
Michael S. Klishin 2012-03-22 01:28:21 +04:00
parent 1db1e04b0a
commit 60a14e62e7

View file

@ -44,6 +44,17 @@
(mgcol/update-by-id collection doc-id { :language "Erlang" })
(is (= (modified-doc (mgcol/find-by-id collection doc-id))))))
(deftest update-nested-document-fields-without-upsert-using-update-by-id
(let [collection "libraries"
doc-id (ObjectId.)
date (Date.)
doc { :created-at date :data-store "MongoDB" :language { :primary "Clojure" } :_id doc-id }
modified-doc { :created-at date :data-store "MongoDB" :language { :primary "Erlang" } :_id doc-id }]
(mgcol/insert collection doc)
(is (= (doc (mgcol/find-by-id collection doc-id))))
(mgcol/update-by-id collection doc-id { $set { "language.primary" "Erlang" }})
(is (= (modified-doc (mgcol/find-by-id collection doc-id))))))
(deftest update-multiple-documents
(let [collection "libraries"]