Get document revisions.

Share:

Description

Get document revisions.

Usage

1
db_revisions(cushion, dbname, docid, simplify = TRUE, as = "list", ...)

Arguments

cushion

A Cushion object. Required.

dbname

Database name

docid

Document ID

simplify

(logical) Simplify to character vector of revision ids. If FALSE, gives back availabilit info too. Default: TRUE

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
## Not run: 
(x <- Cushion$new())

if ("sofa" %in% db_list(x)) {
 db_delete(x, dbname = "sofadb")
}
db_create(x, dbname = "sofadb")

doc1 <- '{"name": "drink", "beer": "IPA", "score": 5}'
doc_create(x, dbname="sofadb", doc1, docid="abeer")
doc_create(x, dbname="sofadb", doc1, docid="morebeer", as='json')

db_revisions(x, dbname="sofadb", docid="abeer")
db_revisions(x, dbname="sofadb", docid="abeer", simplify=FALSE)
db_revisions(x, dbname="sofadb", docid="abeer", as='json')
db_revisions(x, dbname="sofadb", docid="abeer", simplify=FALSE, as='json')

## End(Not run)