New CFMongoDB Available

Friday, December 21, 2012

A new version of CFMongoDB is available on the developer branch, here: https://github.com/marcesher/cfmongodb

This version includes the latest MongDB Java driver as well as 2 significant changes:

1) The new MongoClient is now preferred over the legacy Mongo object. All of the unit tests and examples have been updated to use this object. It's API compatible with Mongo. The significant difference between MongoClient and Mongo is that MongoClient now waits for the database to acknowledge writes, rather than tossing it over the socket and returning immediately. 10Gen wrote about this change here: http://blog.mongodb.org/post/36666163412/introducing-mongoclient. In essence this simply changes the default WriteConcern from UNACKNOWLEDGED to ACKNOWLEDGED.

In addition, I've enhanced the API so that setting MongoOptions is now much simpler. In fact, reverting to the previous default of UNACKNOWLEDGED write behavior is a very simple affair, if you choose that. Please see examples/mongoClientOptions/index.cfm for usage.

2) Integration of the recently introduced MongoDB aggregation framework... see http://docs.mongodb.org/manual/aggregation/. It's in general much faster, and easier to use, than MapReduce. 

The Aggregation Framework is now a first-class citizen in CFMongoDB, just as normal searching and MapReduce are. Please see examples/aggregation/aggregate.cfm for usage.

Huge thanks to Sean Daniels for starting this work!

Full Disclosure:  though all unit tests and examples work as expected, I am not currently using either of these in production.

If you hit any snags, have suggestions, or otherwise want to improve or contribute, please file issues and pull requests.

Happy Coding (and testing),

Marc