DocumentCollection クラス

定義

Azure Cosmos DB サービスのドキュメント コレクションを表します。 コレクションは、ドキュメントの名前付き論理コンテナーです。

public class DocumentCollection : Microsoft.Azure.Documents.Resource
type DocumentCollection = class
    inherit Resource
Public Class DocumentCollection
Inherits Resource
継承
DocumentCollection

次の例では、ユニットあたりの要求スループットが 50000 の新しいパーティション分割コレクションを作成します。 パーティション キーは、このコレクション内のすべてのドキュメントの最初のレベルの 'country' プロパティです。

DocumentCollection collection = await client.CreateDocumentCollectionAsync(
    databaseLink,
    new DocumentCollection 
    { 
        Id = "MyCollection",
        PartitionKey = new PartitionKeyDefinition
        {
            Paths = new Collection<string> { "/country" }
        }
    }, 
    new RequestOptions { OfferThroughput = 50000} ).Result;

次の例では、OfferThroughput が 10000 に設定された新しいコレクションを作成します。

DocumentCollection collection = await client.CreateDocumentCollectionAsync(
    databaseLink,
    new DocumentCollection { Id = "MyCollection" }, 
    new RequestOptions { OfferThroughput = 10000} ).Result;

次の例では、カスタム インデックス作成ポリシーを使用して新しいコレクションを作成します。

DocumentCollection collectionSpec = new DocumentCollection { Id ="MyCollection" };
collectionSpec.IndexingPolicy.Automatic = true;
collectionSpec.IndexingPolicy.IndexingMode = IndexingMode.Consistent;
collection = await client.CreateDocumentCollectionAsync(database.SelfLink, collectionSpec);

次の例では、このコレクション内に Book 型のドキュメントを作成します。

Document doc = await client.CreateDocumentAsync(collection.SelfLink, new Book { Title = "War and Peace" });

次の例では、Id で Database に対してクエリを実行して SelfLink を取得します。

using Microsoft.Azure.Documents.Linq;
DocumentCollection collection = client.CreateDocumentCollectionQuery(databaseLink).Where(c => c.Id == "myColl").AsEnumerable().FirstOrDefault();
string collectionLink = collection.SelfLink;

次の例では、このコレクションを削除します。

await client.DeleteDocumentCollectionAsync(collection.SelfLink);

注釈

データベースには 0 個以上の名前付きコレクションを含め、各コレクションは 0 個以上の JSON ドキュメントで構成されます。 スキーマフリーの場合、コレクション内のドキュメントは同じ構造またはフィールドを共有する必要はありません。 コレクションはアプリケーション リソースであるため、マスター キーまたはリソース キーを使用して承認できます。 コレクションの詳細については、こちらを参照してください。

コンストラクター

DocumentCollection()

Azure Cosmos DB サービスの クラスの DocumentCollection 新しいインスタンスを初期化します。

プロパティ

AltLink

Azure Cosmos DB サービスからリソースに関連付けられている alt-link を取得します。

(継承元 Resource)
ConflictResolutionPolicy

Azure Cosmos DB サービスの ConflictResolutionPolicy コレクション内の異なるリージョンのドキュメントに対する競合する書き込みを解決するために使用される を取得または設定します。

ConflictsLink

Azure Cosmos DB サービスからコレクション内の競合の自己リンクを取得します。

DefaultTimeToLive

Azure Cosmos DB サービスからコレクション内のドキュメントの既定の有効期間を秒単位で取得します。

DocumentsLink

Azure Cosmos DB サービスからコレクション内のドキュメントのセルフリンクを取得します。

ETag

Azure Cosmos DB サービスからリソースに関連付けられているエンティティ タグを取得します。

(継承元 Resource)
GeospatialConfig

GeospatialConfig Azure Cosmos DB サービスからコレクションに関連付けられている を取得します。

Id

Azure Cosmos DB サービス内のリソースの ID を取得または設定します。

(継承元 Resource)
IndexingPolicy

IndexingPolicy Azure Cosmos DB サービスからコレクションに関連付けられている を取得します。

PartitionKey

Azure Cosmos DB サービスのオブジェクトを取得または設定 PartitionKeyDefinition します。

PartitionKeyDeleteThroughputFraction
古い.

コレクションの PartitionKeyDeleteThroughputFraction を取得または設定します。

PartitionKeyRangeStatistics

Azure Cosmos DB サービス内の オブジェクトの PartitionKeyRangeStatistics コレクションを取得します。

ResourceId

Azure Cosmos DB サービスのリソースに関連付けられているリソース ID を取得または設定します。

(継承元 Resource)
SelfLink

Azure Cosmos DB サービスからリソースに関連付けられているセルフリンクを取得します。

(継承元 Resource)
StoredProceduresLink

Azure Cosmos DB サービスからコレクション内のストアド プロシージャのセルフリンクを取得します。

Timestamp

Azure Cosmos DB サービスから、リソースに関連付けられている最後に変更されたタイムスタンプを取得します。

(継承元 Resource)
TimeToLivePropertyPath

ライブベースタイムスタンププロパティパスまでの時間を取得または設定します。

TriggersLink

Azure Cosmos DB サービスからコレクション内のトリガーのセルフリンクを取得します。

UniqueKeyPolicy

Azure Cosmos DB サービスの UniqueKeyPolicy コレクション内のドキュメントの一意性を保証する を取得または設定します。

UserDefinedFunctionsLink

Azure Cosmos DB サービスからコレクション内のユーザー定義関数のセルフリンクを取得します。

メソッド

GetPropertyValue<T>(String)

指定したプロパティ名に関連付けられているプロパティ値を Azure Cosmos DB サービスから取得します。

(継承元 Resource)
LoadFrom(JsonReader)

Azure Cosmos DB サービスの指定した JSON リーダーからオブジェクトを読み込みます。

(継承元 JsonSerializable)
LoadFrom(JsonReader, JsonSerializerSettings)

Azure Cosmos DB サービスの指定した JSON リーダーからオブジェクトを読み込みます。

(継承元 JsonSerializable)
SaveTo(Stream, SerializationFormattingPolicy)

オブジェクトを Azure Cosmos DB サービスの指定したストリームに保存します。

(継承元 JsonSerializable)
SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings)

オブジェクトを Azure Cosmos DB サービスの指定したストリームに保存します。

(継承元 JsonSerializable)
SetPropertyValue(String, Object)

Azure Cosmos DB サービスの指定したプロパティ名に関連付けられているプロパティ値を設定します。

(継承元 Resource)
ToByteArray()

Azure Cosmos DB サービスの SaveTo を使用してバイト配列にシリアル化します。

(継承元 Resource)
ToString()

Azure Cosmos DB サービス内の オブジェクトの文字列表現を返します。

(継承元 JsonSerializable)

適用対象

こちらもご覧ください