FireDAC.Phys.MongoDBWrapper.TMongoExpression.Append

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Append(const ADoc: TMongoDocument): TMongoExpression<T>; overload; inline;
function Append(const AJSON: String): TMongoExpression<T>; overload; inline;
function Append(const AItems: array of const): TMongoExpression<T>; overload;

C++

TMongoExpression__1<T>* __fastcall Append(TMongoDocument* const ADoc)/* overload */;
TMongoExpression__1<T>* __fastcall Append(const System::UnicodeString AJSON)/* overload */;
TMongoExpression__1<T>* __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 TMongoExpression

Description

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

Use this method to append a specified content to this expression. 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 expression.

 Append(const AJSON: String)

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

Append(const AItems: array of const)

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

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
  oExp: TMongoExpression;
.....
  oExp.Append('{"coord": [-73.95, 40.77]}');

C++Builder:

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

See Also