How to assign MongoDB cursor?
How to assign MongoDB cursor?
Ok so I have to assign the MongoDB cursor in code to activate my Dataset. So:
How do I assign a MongoDB cursor directly to a specific database and collection? This example code works great, assuming all you want is a list of databases:
procedure TForm1.FormCreate(Sender: TObject);
begin
FDConnection1.Connected := True;
FMongoConn := TMongoConnection(FDConnection1.CliObj);
FDMongoDataSet1.Close;
FDMongoDataSet1.Cursor := FMongoConn.ListDatabases;
FDMongoDataSet1.Open;
end;
But I want a cursor assigned to my collection so I can pull up all it's records into a DB Grid. Assuming database testDB and collection testCollection.
Any help is much appreciated! Thanks!
Ok so I have to assign the MongoDB cursor in code to activate my Dataset. So:
How do I assign a MongoDB cursor directly to a specific database and collection? This example code works great, assuming all you want is a list of databases:
procedure TForm1.FormCreate(Sender: TObject);
begin
FDConnection1.Connected := True;
FMongoConn := TMongoConnection(FDConnection1.CliObj);
FDMongoDataSet1.Close;
FDMongoDataSet1.Cursor := FMongoConn.ListDatabases;
FDMongoDataSet1.Open;
end;
But I want a cursor assigned to my collection so I can pull up all it's records into a DB Grid. Assuming database testDB and collection testCollection.
Any help is much appreciated! Thanks!
Comments
Post a Comment