The general consensus with Clojure these days is to avoid reliance on
dynamically bound variables. I've just gone through a major overhaul
of the Clojure contrib JDBC wrapper, clojure.java.jdbc, to remove the
global *db* variable and provide a more functional, more idiomatic API
for that library. I plan to do the same with CongoMongo at some point.
Accordingly, I'd avoid set-connection! - it's likely to go away (it'll
be deprecated in the short term, and disappear in the long term) - and
use with-mongo calls although even those will change at some point
since they also rely on dynamically bound globals, however there
syntax is likely to change less.
Currently you'd have:
(with-mongo mongo-spec
... do a bunch of MongoDB stuff ...)
The API will likely change to:
(with-mongo [db mongo-spec]
... do a bunch of MongoDB stuff passing db into each call ...)
What I did with clojure.java.jdbc was introduce
clojure.java.jdbc.deprecated with the old API, and rework (and mostly
rename) what was in clojure.java.jdbc to be the new API. In a couple
of releases, clojure.java.jdbc.deprecated will go away completely
(since it will no longer be maintained anyway). I'll probably take a
similar approach with CongoMongo.
Having used CongoMongo extensively in production for a couple of
years, there are quite a few things I'd like to change about a number
of the API functions...
Sean
> --
> You received this message because you are subscribed to the Google Groups
> "congomongo-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
congomongo-de...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View --
http://corfield.org/
World Singles, LLC. --
http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)