FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...


vdev-coldbox Public


End of Life Notification: This module is no longer in active development.  Bug reports for major issues related to Coldbox module integration will be supported through 6/5/2016.  Please consider transitioning to CBMongoDB , which is in active development and provides better features, increased performance, and uses the MongoDB v3 driver series.

Note: This Forgebox entry is a branched fork from Marc Escher's CFMongodb Project for use as a Coldbox Module.  It is a required dependency for the CBMongoDB module.

CFMongoDB is both partial wrapper for the MongoDB Java driver and a document-struct mapper for ColdFusion. It attempts to remove the need for constant javacasting in your CFML when working with MongoDB. Additionally, there’s a simple DSL which provides ColdFusion developers the ability to easily search MongoDB document collections.

CFMongoDB works with Adobe ColdFusion 9.0.1+ and Railo 3.2+


As of August 20, 2011, collection.update(), collection.findAndModify(), and “sort” all introduced breaking changes!

update() and findAndModify()

They no longer wrap documents in {$set} automatically.

You will need to change your “update” documents like so:

old: {newField="hey"}

new: { “$set” = {newField="hey"} }


Sort must now be a structure… string support is no longer supported.

old: find(sort=“TS=-1”)

new: find(sort={"TS"=-1})

Some Code

One of the most appealing aspects is that data can be created as a ColdFusion structure and persisted almost verbatim. Example:


col = mongo.getDBCollection( 'my_collection' );
my_struct = {
  name = 'Orc #getTickCount()#'
  foo = 'bar'
  bar = 123
  'tags'=[ 'cool', 'distributed', 'fast' ]
}; my_struct );

result = col.query().startsWith('name','Orc').find(limit=20);
writeOutput("Found #result.size()# of #result.totalCount()# Orcs");

//use the native mongo cursor. it is case sensitive!
cursor = result.asCursor();
while( cursor.hasNext() ){
  thisOrc =;
  writeOutput(" name = #thisOrc['name']# <br>");

//use a ColdFusion array of structs. this is not case sensitive
orcs = result.asArray();
for(orc in orcs){
  writeOutput(" name = <br>");


More Examples

See examples/gettingstarted.cfm to start.

Additional examples are in the various subdirectories in examples/

The Wiki

Check out the wiki for additional info:

Getting Help

We have a Google group:

Please limit conversations to MongoDB and ColdFusion. General MongoDB questions are best asked on the MongoDB group at

Posting Issues

Post issues to the github issue tracker for the project. Better: post fixes. Best: post fixes with unit tests.

Getting Involved

Collaboration is welcome. Fork — Commit — Request a pull. For bug fixes and feature additions, commits with unit tests are much more likely to be accepted.

Code well.

Dependencies (0)

Dev Dependencies (0)

box install cfmongodb


$ box install cfmongodb

No collaborators yet.
  • {{ getFullDate("Jan 20 2015 09:01 AM GMT") }}
  • {{ getFullDate("Jun 10 2016 04:06 AM GMT") }}
  • 1,819
  • 1,302
  • 30