FireDAC.Phys.MongoDBWrapper.TMongoDocument.Add

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function Add(const AKey: String; const AValue: String): TMongoDocument; overload;
function Add(const AKey: String; const AValue: Int32): TMongoDocument; overload;
function Add(const AKey: String; const AValue: Int64): TMongoDocument; overload;
function Add(const AKey: String; const AValue: Extended): TMongoDocument; overload;
function Add(const AKey: String; const AValue: Boolean): TMongoDocument; overload;
function Add(const AKey: String; const AValue: TDateTime): TMongoDocument; overload;
function Add(const AKey: String; const AValue: TBytes;  ABinaryType: TJsonBinaryType = TJsonBinaryType.Generic): TMongoDocument; overload;
function Add(const AKey: String; const AValue: TMongoOID): TMongoDocument; overload;
function Add(const AKey: String; const AValue: TJsonOid): TMongoDocument; overload;
function Add(const AKey: string; const AValue: TJsonRegEx): TMongoDocument; overload;
function Add(const AKey: string; const AValue: TJsonDBRef): TMongoDocument; overload;
function Add(const AKey: string; const AValue: TJsonCodeWScope): TMongoDocument; overload;
function Add(const AKey: String; const AValue: TVarRec): TMongoDocument; overload;
function Add(const AKey: String; const AValues: array of const): TMongoDocument; overload;
function Add(const AKey: String; const AValue: Variant): TMongoDocument; overload;

C++

TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::UnicodeString AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const int AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const __int64 AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Extended AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const bool AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::TDateTime AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::DynamicArray<System::Byte> AValue, System::Json::Types::TJsonBinaryType ABinaryType = (System::Json::Types::TJsonBinaryType)(0x0))/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, TMongoOID* const AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Json::Types::TJsonOid &AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Json::Types::TJsonRegEx &AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Json::Types::TJsonDBRef &AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Json::Types::TJsonCodeWScope &AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::TVarRec &AValue)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::TVarRec *AValues, const int AValues_High)/* overload */;
TMongoDocument* __fastcall Add(const System::UnicodeString AKey, const System::Variant &AValue)/* overload */;

プロパティ

種類 可視性 ソース ユニット
function public
FireDAC.Phys.MongoDBWrapper.pas
FireDAC.Phys.MongoDBWrapper.hpp
FireDAC.Phys.MongoDBWrapper TMongoDocument


説明

特定の型のキー/値ペアまたは配列要素を追加し、このオブジェクトの参照を返します。

このメソッドを使用して、キー/値ペアまたは配列要素を MongoDB ドキュメントに新しく追加することができます。

このメソッドはオーバーロードされています。オーバーロード メソッドのうち適切なものを使用して、特定の型のキー/値ペアまたは配列要素を追加します。

メソッド ヘッダー 説明
 Add(const AKey: String; const AValue: String)

String 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: Int32)

Int32 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: Int64)

Int64 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: Extended)

Extended 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: Boolean)

Boolean 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TDateTime)

TDateTime 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TBytes;
      ABinaryType: TJsonBinaryType = TJsonBinaryType.Generic)

TBytes 型のキー/値ペアまたは配列要素を追加します。必要に応じて ABinaryType パラメータ(BSON バイナリ サブタイプに対応)を指定することができます。

Add(const AKey: String; const AValue: TMongoOID)

TMongoOID 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TJsonOid)

TJsonOid 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TJsonRegEx)

TJsonRegEx 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TJsonDBRef)

TJsonDBRef 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TJsonCodeWScope)

TJsonCodeWScope 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValue: TVarRec)

TVarRec 型のキー/値ペアまたは配列要素を追加します。

Add(const AKey: String; const AValues: array of const)

ネスト配列を追加します。このとき、配列要素には AValues オープン配列を使用します。

このオープン配列は "解析済み" の JSON を表します。項目を追加する方法は次のとおりです。

  • キー/値ペアを追加するには、キー名の後に値を指定します。
  • 配列要素を追加するには、値だけを指定します。
  • ネスト オブジェクトを追加するには、キー/値ペアを '{' と '}' で囲む必要があります。
  • ネスト配列を追加するには、要素を '[' と ']' で囲む必要があります。

次に例を示します。

    • Add('coords', [123.45, 80.90]) -> "coords": [123.45, 80.90]
    • Add('grades', ['{', 'grade', 'A', 'score', 11, '}', '{', 'grade', 'B', 'score', 17, '}']) -> "grades": [{"grade": "A", "score": 11}, {"grade": "B", "score": 17}]
Add(const AKey: String; const AValue: Variant)

バリアント データ型が表す型のキー/値ペアまたは配列要素を追加します。

メモ: 配列を追加する場合には、AKey の値は無視されます。読みやすくするために配列インデックスを指定してもかまいません。

明確になるよう以下に例を挙げます。

Delphi の場合:
var
  oDoc: TMongoDocument;
....
  oDoc := FEnv.NewDoc;
  oDoc
    .BeginObject('address')
      .Add('street', '2 Avenue')
      .Add('zipcode', '10075')
      .Add('building', '1480')
      .BeginArray('coord')
        .Add('0', -73.9557413)
        .Add('1', 40.7720266)
      .EndArray
    .EndObject
    .Add('borough', 'Manhattan')
    .Add('cuisine', 'Italian');
C++Builder の場合:
....
  TMongoDocument *oDoc = FEnv->NewDoc();
  oDoc
    ->BeginObject("address")
      ->Add("street", System::UnicodeString("2 Avenue"))
      ->Add("zipcode", System::UnicodeString("10075"))
      ->Add("building", System::UnicodeString("1480"))
      ->BeginArray("coord")
        ->Add("0", -73.9557413)
        ->Add("1", 40.7720266)
      ->EndArray()
    ->EndObject()
    ->Add("borough", System::UnicodeString("Manhattan"))
    ->Add("cuisine", System::UnicodeString("Italian"));

関連項目