Learn R Programming

nodbi (version 0.9.0)

docdb_delete: Delete documents or container

Description

Delete documents or container

Usage

docdb_delete(src, key, ...)

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.

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:

  • MongoDB: find() in mongolite::mongo()

  • SQLite: ignored

  • Elasticsearch: elastic::Search()

  • CouchDB: sofa::db_alldocs()

  • PostgreSQL: ignored

  • DuckDB: ignored

Examples

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

Run the code above in your browser using DataLab