CFMongoDB - MongoDB 的 ColdFusion 开发包


未知
Windows

软件简介

CFMongoDB 是 MongoDB
ColdFusion 开发包,示例代码:

<cfscript>

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

col.save( my_struct );

//query
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 = 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>