docdb_delete: Delete documents or container

View source: R/delete.R

docdb_deleteR Documentation

Delete documents or container

Description

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() src_duckdb() or src_postgres()

key

(character) The name of the container in the database backend (corresponds to collection for MongoDB, dbname for CouchDB, index for Elasticsearch and to a table name for DuckDb, SQLite and PostgreSQL)

...

Optionally, specify query parameter with a JSON query as per docdb_query() to identify documents to be deleted. If not specified, the default is to delete the container key.

Other parameters are passed on to functions:

  • MongoDB: ignored

  • SQLite: ignored

  • Elasticsearch: ignored

  • CouchDB: sofa::db_delete() or sofa::doc_delete()

  • PostgreSQL: ignored

  • DuckDB: ignored

Value

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

Examples

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

## End(Not run)

nodbi documentation built on Sept. 24, 2023, 1:08 a.m.