I recently forked congomongo and added a couple lines to support DBRef
creation and eager fetching by the existing fns. I also added some
basic support for executing database commands. Figured somebody else
might have similar needs.
https://github.com/rcampbell/congomongo
I wasn't sure how Steve & co would want to support eager fetching, so
instead of modifying existing code I created a decorator like so:
(def eager-command (with-ref-fetching command))
or
(def eager-fetch (with-ref-fetching fetch))
etc, which decorates fetch et. al., walking the result (if :clojure)
and fetching any nested DBRefs, so:
{:_id #<ObjectId 4ddf94b2aec7cc2220d30cfb>,
:type "foo",
:user
#<DBRef { "$ref" : "users", "$id" : "4dde672daec7c9b294446ebd" }>,
:timestamp #<Date Fri May 27 14:10:26 CEST 2011>}}
becomes:
{:_id #<ObjectId 4ddf94b2aec7cc2220d30cfb>,
:type "foo",
:user
{:_id #<ObjectId 4dde672daec7c9b294446ebd>,
:email "
m...@foo.com",
:password
"$2a$10$HubC/TN3fiJTY7h69WntUee1sPYiBC0jvkK311vC5fHajRhxgteU6",
:nickname "rrc7cz"},
:timestamp #<Date Fri May 27 14:10:26 CEST 2011>}}
without impacting existing fetch functionality.