Anyone use MongoDB yet with Delphi and understand how to insert JSON data to the db? I don't see anything in the examples but maybe I have missed it. Here is how I am doing my Inserts:
Anyone use MongoDB yet with Delphi and understand how to insert JSON data to the db? I don't see anything in the examples but maybe I have missed it. Here is how I am doing my Inserts:
begin
oDoc := FEnv.NewDoc;
try
// Build new document
oDoc
.Add('Field1', 'test data 1')
.Add('Field2', 'test data 2')
.Add('Field3', 'test data 3')
.Add('Field4', 'test data 4');
// Insert new document into "testCollection" collection in "testDB" database.
FCon['testDB']['testCollection'].Insert(oDoc);
finally
oDoc.Free;
end;
How does JSON fit into this? Thanks!
begin
oDoc := FEnv.NewDoc;
try
// Build new document
oDoc
.Add('Field1', 'test data 1')
.Add('Field2', 'test data 2')
.Add('Field3', 'test data 3')
.Add('Field4', 'test data 4');
// Insert new document into "testCollection" collection in "testDB" database.
FCon['testDB']['testCollection'].Insert(oDoc);
finally
oDoc.Free;
end;
How does JSON fit into this? Thanks!
Comments
Post a Comment