0
comment
comment
on 6/10/2011 5:33 PM
CongoMongo is a Clojure wrapper around the MongoDB Java driver. It makes it pretty easy to interact with MongoDB:
(use 'somnium.congomongo)
;; connect to "example" database via mongo1:27017 or
;; mongo2:25017 seed hosts (I have a replica set running)
(def db (make-connection :example
{ :host "mongo1" } { :host "mongo2" :port 25017 } ))
;; insert a document into the "clojure" collection:
(with-mongo db
(insert! :clojure
{:name "Clojure" :tagline "The language from the future."}))
;; fetch one doc[...]