I've read the instructions from here https://www.devart.com/unidac/docs/using-mongodb.htm, but I can't quite get along with using the components yet.
Can I create a collection? UniQuery1.SQL.Text := '{"create": "food"}'; doesn't work.
Or are there only the listed methods "find, insert, update, delete" availible?
Inserting new data works (I also checked with the MongoDB shell), but how can I read existing data?
I have tried the following:
Code: Select all
UniQuery1.SQL.Text := '{"insert":"restaurants", "documents":[{"_id":3, "name":"Venezia", "cuisine":"italian"}]}';
UniQuery1.Execute;
UniQuery1.SQL.Clear;
UniQuery1.Close;
UniQuery1.SQL.Text := '{"find":"restaurants", "filter":{"cuisine":"italian"}}';
// UniQuery1.SQL.Text := '{"find":"restaurants"}'; - alternatively, with no difference
UniQuery1.Open;
Then I would like to print the contents of the document (but in my case document is NIL):
Code: Select all
var
Document: TMongoDocument;
begin
Document := UniQuery1.GetObject('restaurants') as TMongoDocument;
ShowMessage(Document.Text);
Best regards,
Sven