New CFMongoDB Version Available

151 views
Skip to first unread message

Marc Esher

unread,
Dec 20, 2012, 6:52:11 PM12/20/12
to cfmo...@googlegroups.com
All,

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 old "Mongo" object. All of the unit tests and examples have been updated to use this object. It's API compatible with the old "Mongo" object. The significant difference between MongoClient and Mongo is that MongoClient now waits for the write to succeed, rather than tossing it over the wall and returning immediately. 10Gen wrote about this change here: http://blog.mongodb.org/post/36666163412/introducing-mongoclient

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

2) Integration of the new MongoDB aggregation framework. The Aggregation Framework was recently introduced... 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

Hendrik Kramer

unread,
Jan 21, 2013, 1:37:43 PM1/21/13
to cfmo...@googlegroups.com
Awesome! Thanks for all your hard work on this library.

Nolan Dubeau

unread,
Mar 31, 2013, 7:47:35 PM3/31/13
to cfmo...@googlegroups.com
Great stuff Marc!  I'm looking forward to trying it out! 

Question.  I'm building an app on Railo 4.  On RIAForge it says that CFMongoDB currently only supports Railo 3.2.  Will it work on Railo 4?

Cheers,

Nolan

Marc Esher

unread,
Apr 2, 2013, 6:56:15 AM4/2/13
to cfmo...@googlegroups.com
Hey Nolan,

Yes, it *should* work, though I haven't tested it.


--
You received this message because you are subscribed to the Google Groups "CFMongoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfmongodb+...@googlegroups.com.

To post to this group, send email to cfmo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Nolan Dubeau

unread,
Apr 2, 2013, 6:00:36 PM4/2/13
to cfmo...@googlegroups.com
Great thanks.  Also, is it possible to use this to connect to an external mongo instance such as mongolab?

Thanks 
Nolan
Sent from my mobile. 

Marc Esher

unread,
Apr 3, 2013, 3:19:12 PM4/3/13
to cfmo...@googlegroups.com
Sure. Just pass in the appropriate credentials, server IP(s), etc in MongoConfig

James Moberg

unread,
Nov 19, 2013, 11:31:20 AM11/19/13
to cfmo...@googlegroups.com
Is it possible to use 2 combined items as the document ID?  The MongoDB documention seems to indicate that it's possible, but I can't seem to do it with the CFMongoDB aggregation library.
http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/#return-average-city-population-by-state

My collection has a "HitType" (string) and a date (set to midnight).  I tried this:
StatsbyDate = Stats.aggregate(
        { "$group"={ "_id"={"HITTYPE"="$HITTYPE", "DATE"="$DATE"}, "total"={ "$sum"=1 } } },
        { "$project"={ "HitData"={"HITTYPE"="$_id.HITTYPE", "DATE"="$_id.DATE"}, "numberOfHits"="$total", "_id"=0 } },
        { "$sort"= { "HitData.DATE"=1 } }
)

The result returned contains an array with only the "HITTYPE" value in the id.  Is this not supported with the aggregate library or is this a bug?  If either, is there a better way to accomplish this?  Thanks.

1) [struct]
	HitData:  
		[struct]
		HITTYPE: W
	numberOfHits: 450 
2) [struct]
	HitData:  
		[struct]
		HITTYPE: P
	numberOfHits: 67 
3) [struct]
	HitData:  
		[struct]
		HITTYPE: V
	numberOfHits: 2427 

Reply all
Reply to author
Forward
0 new messages