FireDAC.Phys.MongoDBWrapper.TMongoCursor
Delphi
TMongoCursor = class(TMongoObject)
C++
class PASCALIMPLEMENTATION TMongoCursor : public TMongoObject
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | FireDAC.Phys.MongoDBWrapper.pas FireDAC.Phys.MongoDBWrapper.hpp |
FireDAC.Phys.MongoDBWrapper | FireDAC.Phys.MongoDBWrapper |
Description
Represents a MongoDB cursor that you can use to iterate through the documents of a result set.
You must not create an instance of TMongoCursor directly. You can obtain an instance of TMongoCursor from most of the functions that return an object that implements the IMongoCursor interface, such as TMongoConnection.Command or TMongoDatabase.ListCollections.
Next points the Doc property to the next available document, and returns True
if there was an available document or False
if there was no available document. Combine Next and Doc to iterate through the documents of a cursor:
Delphi:
while MyCursor.Next do
begin
MyDocument := MyCursor.Doc;
// …
end;
C++:
while (MyCursor->Next()) {
TMongoDocument* MyDocument = MyCursor->Doc();
// …
}
You can use IsAlive to determine whether or not there are more documents to read from the cursor. Unlike Next, IsAlive does not iterate the cursor, it only checks whether or not the cursor contains more documents.