Mongodb 执行eval命令

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;

Mongodb 执行eval命令

上一篇:有趣的sql


下一篇:SQL查询中in和exists的区别分析