Created
September 13, 2011 18:49
-
-
Save mariusk/1214676 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[somnium.congomongo :as mongo]) | |
(require '[somnium.congomongo.config :as mongoconfig]) | |
(mongo/drop-database! "congomongotest") | |
(mongo/mongo! :db "congomongotest") | |
(mongo/set-write-concern mongoconfig/*mongo-config* :strict) | |
(mongo/add-index! :users [:userid] :unique true) | |
(pr (mongo/insert! :users {:userid "aa" :pwhash "bb"})) | |
;; Statement below fails, i.e. no data gets written, but | |
;; it still returns a mongodb instance object.. How to | |
;; detect that an insert failed? | |
(pr (mongo/insert! :users {:userid "aa" :pwhash "bb"})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment