createCollection: Creates a collection.

Description Usage Arguments Value Examples

Description

Creates a collection.

Usage

1
2
3
createCollection(connectionInfo, collectionId, throughput = "",
  partitionKey = "", indexingPolicy = "", databaseId = "",
  consistencyLevel = "", sessionToken = "", userAgent = "")

Arguments

connectionInfo

A DocumentDB connection info object generated with getDocumentDBConnectionInfo().

collectionId

The ID of the collection to create.

throughput

Optional. The user specified throughput for the collection expressed in units of 100 request units per second. This can be between 400 and 250,000 (or higher by requesting a limit increase). If the value is over 10,000, then the collection must include a partitionKey definition. If the value is equal to or under 10,000, then the collection must not include a partitionKey definition.

partitionKey

Optional. This value is used to configure the partition key to be used for partitioning data into multiple partitions. If the throughput value is over 10,000, then the collection must include a partitionKey definition. If the throughput value is equal to or under 10,000, then the collection must not include a partitionKey definition.

indexingPolicy

Optional. This value is used to configure indexing policy. By default, the indexing is automatic for all document paths within the collection. To specify a custom indexing policy pass a string with a JSON element, eg. "indexingPolicy": .... See https://docs.microsoft.com/en-us/rest/api/documentdb/create-a-collection for more details.

databaseId

Optional. The ID of the database in which to create the collection. If no database ID is specified, the ID will be taken from the connection info.

consistencyLevel

Optional. The consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest). The override must be the same or weaker than the account's configured consistency level.

sessionToken

Optional. A string token used with session level consistency. For more information, see Using consistency levels in DocumentDB.

userAgent

Optional. A string that specifies the client user agent performing the request. The recommended format is user agent name/version. For example, the official DocumentDB .NET SDK sets the User-Agent string to Microsoft.Document.Client/1.0.0.0. A custom user-agent could be something like ContosoMarketingApp/1.0.0.

Value

Some information extracted from the REST API response such as request charge and session token.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# load the documentdbr package
library(documentdbr)

# setup connection infos
myDocDB <- getDocumentDBConnectionInfo(
  accountUrl = "https://somedocumentdbaccount.documents.azure.com",
  primaryOrSecondaryKey = "t0C36UstTJ4c6vdkFyImkaoB6L1yeQidadg6wasSwmaK2s8JxFbEXQ0e3AW9KE1xQqmOn0WtOi3lxloStmSeeg==",
  databaseId = "MyDatabase"
)

# create the MyCollection collection with default throughput (within MyDatabase as specified in the connection info)
# note: alternatively, the database id can be specified as parameter
createCollection(myDocDB, "MyNewDatabase")

timoklimmer/documentdbr documentation built on May 31, 2019, 2:29 p.m.