Skip to content

Instantly share code, notes, and snippets.

@mariusk
Created September 13, 2011 18:49
Show Gist options
  • Save mariusk/1214676 to your computer and use it in GitHub Desktop.
Save mariusk/1214676 to your computer and use it in GitHub Desktop.
(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