FireDAC.Phys.MongoDBWrapper.IMongoCursor

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

IMongoCursor = interface(IInterface)

C++

__interface  INTERFACE_UUID("{7D8AF712-3FA8-459B-BF9B-4EC7E55B7359}") IMongoCursor  : public System::IInterface

Properties

Type Visibility Source Unit Parent
interface
class
public
FireDAC.Phys.MongoDBWrapper.pas
FireDAC.Phys.MongoDBWrapper.hpp
FireDAC.Phys.MongoDBWrapper FireDAC.Phys.MongoDBWrapper

Description

Represents the result set cursor interface.

The IMongoCursor interface is implemented by:

  • The "fluent" style command builders where a command returns a result set. Therefore casting a builder to the interface executes the command and provides a cursor.
  • The TMongoCursor.TDefault class, which is the default interface implementation.

Examples

To clarify, consider the following examples:

Object Pascal:

 var
  FCon: TMongoConnection;
  oCrs:  IMongoCursor;
  Memo1: TMemo;
// ...
// Find, retrieve and show all documents from the database 'test' (collection 'restaurants')
   oCrs := FCon['test']['restaurants'].Find();
   while oCrs.Next do
      Memo1.Text := Memo1.Text + sLineBreak + oCrs.Doc.AsJSON;

Appmethod C++:

TMongoConnection *FCon;
di_IMongoCursor  oCrs;
Memo1* TMemo;
// ...
// Find, retrieve and show all documents from the database 'test' (collection 'restaurants')
	oCrs =  interface_cast<IMongoCursor>(MongoCon->Databases["test"]->Collections["restaurants"]->Find());
	while (oCrs->Next()) {
          Memo1->Text = Memo1->Text +  sLineBreak + oCrs->Doc->AsJSON;
	}

See Also