Description Usage Arguments Details Value See Also Examples
Delete a set of documents from an Azure Cosmos DB container
1 2 3 4 5 6 7 8 9 10 11 | bulk_delete(container, ...)
## S3 method for class 'cosmos_container'
bulk_delete(
container,
query,
partition_key,
procname = "_AzureCosmosR_bulkDelete",
headers = list(),
...
)
|
container |
A Cosmos DB container object, as obtained by |
query |
A query specifying which documents to delete. |
partition_key |
Optionally, limit the deletion only to documents with this key value. |
procname |
The stored procedure name to use for the server-side import code. Change this if, for some reason, the default name is taken. |
headers, ... |
Optional arguments passed to lower-level functions. |
This is a convenience function to delete multiple documents from a container. It works by creating a stored procedure and then calling it with the supplied query as a parameter. This function is not meant for production use.
The number of rows deleted.
bulk_import, cosmos_container
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
endp <- cosmos_endpoint("https://myaccount.documents.azure.com:443/", key="mykey")
db <- get_cosmos_database(endp, "mydatabase")
cont <- create_cosmos_container(db, "mycontainer", partition_key="sex")
# importing the Star Wars data from dplyr
bulk_import(cont, dplyr::starwars)
# deleting a subset of documents
bulk_delete(cont, "select * from mycontainer c where c.gender = 'masculine'")
# deleting documents for a specific partition key value
bulk_delete(cont, "select * from mycontainer", partition_key="male")
# deleting all documents
bulk_delete(cont, "select * from mycontainer")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.