# NOT RUN {
(x <- Cushion$new())
if ("leothelion" %in% db_list(x)) {
invisible(db_delete(x, dbname="leothelion"))
}
db_create(x, dbname='leothelion')
# no changes
res <- db_changes(x, dbname="leothelion")
res$results
# create a document
doc1 <- '{"name": "drink", "beer": "IPA", "score": 5}'
doc_create(x, dbname="leothelion", doc1, docid="abeer")
# now there's changes
res <- db_changes(x, dbname="leothelion")
res$results
# as JSON
db_changes(x, dbname="leothelion", as='json')
# }
Run the code above in your browser using DataLab