You are not logged in.
Pages: 1
Hi AB,
I ran into this error:
procedure TForm1.Button1Click(Sender: TObject);
var
 t:integer;
 Coll: TMongoCollection;
 Docs: TVariantDynArray;
begin
 log('Start');
 try
  fClient:=TMongoClient.Create('localhost',27017);
  fDB:=fClient.Database['test25'];
  Coll := fDB.CollectionOrCreate['testColl'];
  coll.Insert('{"Age":?,Name: ?}',[1,'test1']);
  coll.Insert('{"Age":?,Name: ?}',[2,'test2']);
  if BADjson.Checked then
  begin
   try
    coll.FindDocs('{Age:{$gt,1}}',[],docs,null); // <------------------------ bad syntax
    for t:=Low(docs) to High(docs) do if not varisnull(docs[t].Name) then Log('Docs:'+docs[t].Name);
   except
    on e: exception do  log('EXC1: '+e.Message);
   end;
  end;
  Coll := fDB.CollectionOrCreate['testColl'];
  try
   coll.FindDocs('{Age:{$gt:1}}',[],docs,null); // <------------------------ right syntax
   for t:=Low(docs) to High(docs) do if not varisnull(docs[t].Name) then Log('Docs:'+docs[t].Name);
  except
   on e: exception do  log('EXC2: '+e.Message);
  end;
 finally
  FreeAndNil(fClient);
  log('end');
 end;
end;with BADsyntax checked output is:
EXC1: Server reset the connection: probably due to a bad formatted BSON request
EXC2: Server reset the connection: probably due to a bad formatted BSON request
...but the second call is correct.
How to reset the error (without having to reconnect) ?
Offline
Of course, the syntax is {$age:{$gt:1}}
The documentation was misleading.
Should be fixed now.
See http://synopse.info/fossil/info/f839bfad2a
Offline
How to reset the error (without having to reconnect) ?
Offline
Pages: 1