FireDAC.Phys.MongoDBWrapper.TMongoDocument.Append

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Append(const ADoc: TMongoDocument): TMongoDocument; overload;
function Append(const AJSON: String): TMongoDocument; overload;
function Append(const AItems: array of const): TMongoDocument; overload;

C++

TMongoDocument* __fastcall Append(TMongoDocument* const ADoc)/* overload */;
TMongoDocument* __fastcall Append(const System::UnicodeString AJSON)/* overload */;
TMongoDocument* __fastcall Append(const System::TVarRec *AItems, const int AItems_High)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
FireDAC.Phys.MongoDBWrapper.pas
FireDAC.Phys.MongoDBWrapper.hpp
FireDAC.Phys.MongoDBWrapper TMongoDocument

Description

Appends a specified content to the end of this document, and returns a reference to this object.

Use this method to add a specified content to this document. This method is overloaded and can be used for adding the content of the following types:

Method Header Description
 Append(const ADoc: TMongoDocument)

Appends the content of the ADoc document to the end of this document.

 Append(const AJSON: String)

Appends the content of the AJSON document to the end of this document.

Append(const AItems: array of const)

Appends an open array AItems to the end of this document.

The open array represents a "parsed" JSON. To add various items, do the following:

  • To add a key-value pair, specify the key name, followed by a value.
  • To add an array element, specify just a value.
  • To add a nested object, its key-value pairs must be surrounded by '{' and '}.
  • To add a nested array, its elements must be surrounded by '[' and ']'.

For example:

  • Append(['coords', [123.45, 80.90]])"coords": [123.45, 80.90]
  • Append(['grades', ['{', 'grade', 'A', 'score', 11, '}', '{', 'grade', 'B', 'score', 17, '}']])"grades": [{"grade": "A", "score": 11}, {"grade": "B", "score": 17}]

Examples

To clarify, consider the following examples:

Delphi:

var
  oDoc: TMongoDocument;
.....
  oDoc.Append('{"coord": [-73.95, 40.77]}');

C++Builder:

...
TMongoDocument *oDoc;
oDoc->Append("{'coord': [-73.95, 40.77]}");

See Also