Delete a document in a database.

Description

Delete a document in a database.

Usage

1
doc_delete(cushion, dbname, docid, as = "list", ...)

Arguments

cushion

A Cushion object. Required.

dbname

Database name. (charcter)

docid

Document ID (character)

as

(character) One of list (default) or json

...

Curl args passed on to one of the HTTP verbs (e.g,. GET, POST, PUT, etc.)

Value

JSON as a character string or a list (determined by the as parameter)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
(x <- Cushion$new())

# create a database
if ("sofadb" %in% db_list(x)) {
  invisible(db_delete(x, dbname="sofadb"))
}
db_create(x, dbname='sofadb')

doc3 <- "<top><a/><b/><c><d/><e>bob</e></c></top>"
doc_create(x, dbname="sofadb", doc=doc3, docid="newnewxml")
doc_delete(x, dbname="sofadb", docid="newnewxml")
doc_delete(x, dbname="sofadb", docid="newnewxml")

# wrong docid name
doc_create(x, dbname="sofadb", doc=doc3, docid="newxml")
doc_delete(x, dbname="sofadb", docid="wrongname")

## End(Not run)