CFMongoDB是MongoDB的ColdFusion开发包,示例代码:
<cfscript>//savecol=mongo.getDBCollection('my_collection');my_struct={name='Orc#getTickCount()#'foo='bar'bar=123'tags'=['cool','distributed','fast']};col.save(my_struct);//queryresult=col.query().startsWith('name','Orc').find(limit=20);writeOutput("Found#result.size()#of#result.totalCount()#Orcs");//usethenativemongocursor.itiscasesensitive!cursor=result.asCursor();while(cursor.hasNext()){thisOrc=cursor.next();writeOutput("name=#thisOrc['name']#<br>");}//useaColdFusionarrayofstructs.thisisnotcasesensitiveorcs=result.asArray();for(orcinorcs){writeOutput("name=#orc.name#<br>");}</cfscript>点击空白处退出提示
评论