How to get Multiple Documents in MongoDB? (Solved)
-
- Posts: 2
- Joined: Tue 15 May 2018 17:04
How to get Multiple Documents in MongoDB? (Solved)
I need to know how to get multiple documents, in your documetation, you are only giving an example about how to get a single document and how to save in the class TMongoDocument, but when the query should return multiple documents, the method TUniQuery.GetObject only returns a single document.
Last edited by rmcrodrigo1 on Wed 16 May 2018 17:24, edited 1 time in total.
Re: How to get Multiple Documents in MongoDB?
You can use a loop to retrieve all the documents of the TUniQuery dataset. For example:
Code: Select all
UniQuery1.Open;
while not UniQuery1.Eof do begin
Document := UniQuery1.GetObject('restaurants') as TMongoDocument;
...
UniQuery1.Next;
end;
-
- Posts: 2
- Joined: Tue 15 May 2018 17:04
Re: How to get Multiple Documents in MongoDB?
thank you so much!