procedure TForm1.BitBtn7Click(Sender: TObject);
var
query,b1,b2:tbson;
buf:tbsonbuffer;
code:tbsoncodewscope;
begin
if dbman=nil then dbman:=tdbmanage.create;
code:=tbsoncodewscope.Create(‘function(){var a=db.testc.find();return a[0].name;}‘,bson([]));
buf:=tbsonbuffer.Create; buf.append(‘eval‘,code);
query:=buf.finish;
showmessage(query.Displaystr.ToString);
b2:=dbman.mongodbs.mongo.command(‘prjdbs‘,query);
b1:=dbman.mongodbs.mongo.getLastErr(‘prjdbs‘);
if b1<>nil then showmessage(b1.Displaystr.ToString);
showmessage(b2.Displaystr.ToString);
end;
原文地址:http://www.cnblogs.com/HuiLove/p/3981346.html