MongoDB - several Questions

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 11
Joined: Wed 15 Jul 2015 11:54

MongoDB - several Questions

Post by ernschd666 » Wed 11 Sep 2019 11:57


I've read the instructions from here, 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.SQL.Text := '{"find":"restaurants", "filter":{"cuisine":"italian"}}';
// UniQuery1.SQL.Text := '{"find":"restaurants"}'; - alternatively, with no difference
RecordCount is then 0 - is that right?

Then I would like to print the contents of the document (but in my case document is NIL):

Code: Select all

  Document: TMongoDocument;
Document := UniQuery1.GetObject('restaurants') as TMongoDocument;
Many thanks in advance.

Best regards,

Devart Team
Posts: 2856
Joined: Wed 30 Jul 2014 07:16

Re: MongoDB - several Questions

Post by ViktorV » Thu 12 Sep 2019 10:59

Currently the CREATE statements are not supported. You can request this functionality on our User Voice forum: ... components to speed up the implementation of the functionality.
Unfortunately, we couldn't reproduce the issue with the latest UniDAC version 8.0.1 in our environment using the data that you've provided.
Please make sure that you use version 8.0.2 and try reproducing the issue.

Post Reply