Skip to contents

Delete documents or container

Usage

docdb_delete(src, key, ...)

Arguments

src

Source object, result of call to any of functions src_mongo(), src_sqlite(), src_elastic(), src_couchdb() or src_postgres()

key

(character) A key as name of the container (corresponds to parameter collection for MongoDB, dbname for CouchDB, index for Elasticsearch and to a table name for SQLite and for PostgreSQL)

...

optional query parameter with a JSON query as per mongolite::mongo() and as working in docdb_query() to identify documents to be deleted. The default is to delete the container key. Other parameters are passed on to functions:

Value

(logical) success of operation. Typically TRUE if document or collection existed and FALSE is document did not exist or collection did not exist or delete was not successful.

Examples

if (FALSE) {
src <- src_sqlite()
docdb_create(src, "iris", iris)
docdb_delete(src, "iris", query = '{"Species": {"$regex": "a$"}}')
docdb_delete(src, "iris")
}