Skip to content

zefer/cfmongodb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFMongoDB

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.

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

<cfscript>

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

mongo.save(my_struct, col);

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

//use the native mongo cursor. it is case sensitive!
cursor = result.asCursor();
while( cursor.hasNext() ){
  thisOrc = cursor.next();
  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 = #orc.name# <br>");
}

</cfscript>

See examples/gettingstarted.cfm to start.

Check out the wiki for additional info : http://wiki.github.com/marcesher/cfmongodb/

Collaboration is welcome.

About

MongoDB client wrapper for ColdFusion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • ColdFusion 93.4%
  • Java 6.6%