Use WriteConcern/SAFE by default

WriteConcern/NORMAL is ridiculously dangerous and most apps simply do not have performance
requirements to justify completely ignoring server responses.
This commit is contained in:
Michael S. Klishin 2011-10-18 17:50:28 +04:00
parent e2b6c6e21b
commit fbd00ee151
3 changed files with 9 additions and 1 deletions

View file

@ -26,7 +26,7 @@
(declare ^:dynamic ^Mongo *mongodb-connection*)
(declare ^:dynamic ^DB *mongodb-database*)
(def ^:dynamic ^WriteConcern *mongodb-write-concern* WriteConcern/NORMAL)
(def ^:dynamic ^WriteConcern *mongodb-write-concern* WriteConcern/SAFE)
;;
@ -84,6 +84,11 @@
(def ^:dynamic *mongodb-database* db))
(defn set-write-concern!
[wc]
(def ^:dynamic *mongodb-write-concern* wc))
(defprotocol Countable
(count [this] "Returns size of the object"))

View file

@ -44,6 +44,7 @@
(use-fixtures :each purge-people-collection purge-docs-collection purge-things-collection purge-libraries-collection)
(monger.core/set-write-concern! WriteConcern/SAFE)
;;
;; insert

View file

@ -27,6 +27,8 @@
;; Tests
;;
(monger.core/set-write-concern! WriteConcern/NORMAL)
(deftest insert-large-batches-of-documents-without-object-ids
(doseq [n [1000 10000 100000]]
(let [collection "things"