I meant to post this a few days ago...

CongoMongo, a Clojure wrapper for MongoDB, just released version 0.2.0 to
Clojars:

Version 0.2.0 - October 10th, 2012:

   - Added URL / license / mailing list information to project.clj so it
   will show up in Clojars and provide a better user experience
   - Allow make-connection to accept symbols again (#80, fixes issue
   introduced in #79)
   - Prevent fetch one / sort being used together (#81)
   - Remove :force option from add-index! since it is no longer effective
   (#82, #83)
   - Add :sparse option to add-index! (#84)
   - Upgrade to 2.9.1 Java driver (#85, #89)
   - Upgrade project to use Clojure 1.4.0 as base version (#86, #88)
   - Upgrade project to use Leiningen 2 (#87)
   - Add aggregate function to leverage MongoDB 2.2 aggregation framework
   (#90)

The bump in the version number (from 0.1.10) signals compatibility with
MongoDB 2.2, the update to the 2.9.x Java driver and the inclusion of an
aggregate function that provides basic support for the new aggregation
framework in MongoDB 2.2:


aggregation (requires mongodb 2.2)

(aggregate
  :expenses
  {:$match {:type "airfare"}}
  {:$project {:department 1, :amount 1}}
  {:$group {:_id "$department", :average {:$avg "$amount"}}})
=> {:serverUsed "...", :result [{:_id ... :average ...} {:_id ...
:average ...} ...], :ok 1.0}

This pipeline of operations selects expenses with type = 'airfare', passes
just the department and amount fields thru, and groups by department with
an average for each.

Based on 10gen's Java Driver example of
aggregation<http://www.mongodb.org/display/DOCS/Using+The+Aggregation+Framework+with+The+Java+Driver>
.

The aggregate function accepts any number of pipeline operations.

-- 
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)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to