cosmos_mongo function

MongoDB endpoint for Azure Cosmos DB

MongoDB endpoint for Azure Cosmos DB

cosmos_mongo_endpoint( host, key, mongo_options = list(), connection_string = NULL ) cosmos_mongo_connection(endpoint, ...) ## S3 method for class 'cosmos_mongo_endpoint' cosmos_mongo_connection(endpoint, collection, database, ...)

Arguments

  • host: For cosmos_mongo_endpoint, the URL of the Cosmos DB MongoDB endpoint. Usually of the form "https://account-name.mongo.cosmos.azure.com:443/".
  • key: For cosmos_mongo_endpoint, a string containing the access key (password) for the endpoint. Can be either a read-write or read-only key.
  • mongo_options: For cosmos_mongo_endpoint, a named list containing any additional parameters for the MongoDB connection string.
  • connection_string: Alternatively, the full connection string for the MongoDB endpoint. If this is supplied, all other arguments to cosmos_mongo_endpoint are ignored. Note that if you already have the full connection string, you most likely do not need AzureCosmosR and can call mongolite::mongo directly.
  • endpoint: For cosmos_mongo_connection, a MongoDB endpoint object as obtained from cosmos_mongo_endpoint.
  • ...: Optional arguments passed to lower-level functions.
  • collection, database: For cosmos_mongo_connection, the collection and database to connect to.

Returns

For cosmos_mongo_endpoint, an object of S3 class cosmos_mongo_endpoint.

For cosmos_mongo_connection, an object of class mongolite::mongo which can then be used to interact with the given collection.

Details

These functions act as a bridge between the Azure resource and the functionality provided by the mongolite package.

Examples

## Not run: mendp <- cosmos_mongo_endpoint("https://mymongoacct.mongo.cosmos.azure.com:443", key="mykey") cosmos_mongo_connection(mendp, "mycollection", "mydatabase") ## End(Not run)

See Also

az_cosmosdb , mongolite::mongo

For the SQL API client framework: cosmos_endpoint , cosmos_database , cosmos_container , query_documents

  • Maintainer: Hong Ooi
  • License: MIT + file LICENSE
  • Last published: 2021-01-18