| get_document {AzureCosmosR} | R Documentation | 
Methods for working with Azure Cosmos DB documents
Description
Methods for working with Azure Cosmos DB documents
Usage
get_document(object, ...)
create_document(object, ...)
## S3 method for class 'cosmos_container'
create_document(object, data, headers = list(), ...)
list_documents(object, ...)
## S3 method for class 'cosmos_container'
list_documents(
  object,
  partition_key = NULL,
  as_data_frame = FALSE,
  metadata = TRUE,
  headers = list(),
  ...
)
delete_document(object, ...)
## S3 method for class 'cosmos_container'
delete_document(
  object,
  id,
  partition_key,
  headers = list(),
  confirm = TRUE,
  ...
)
## S3 method for class 'cosmos_document'
delete_document(object, ...)
Arguments
| object | A Cosmos DB container object, as obtained by  | 
| data | For  | 
| headers,... | Optional arguments passed to lower-level functions. | 
| partition_key | For  | 
| as_data_frame | For  | 
| metadata | For  | 
| id | The document ID. | 
| confirm | For  | 
Details
These are low-level functions for working with individual documents in a Cosmos DB container. In most cases you will want to use query_documents to issue queries against the container, or bulk_import and bulk_delete to create and delete documents.
Value
get_document and create_document return an object of S3 class cosmos_document. The actual document contents can be found in the data component of this object.
list_documents returns a list of cosmos_document objects if as_data_frame is FALSE, and a data frame otherwise.
See Also
query_documents, bulk_import, bulk_delete, cosmos_container
Examples
## Not run: 
endp <- cosmos_endpoint("https://myaccount.documents.azure.com:443/", key="mykey")
db <- get_cosmos_database(endp, "mydatabase")
cont <- get_cosmos_container(db, "mycontainer")
# a list of document objects
list_documents(cont)
# a data frame
list_documents(cont, as_data_frame=TRUE)
# a single document
doc <- get_document(cont, "mydocumentid")
doc$data
delete_document(doc)
## End(Not run)