# NOT RUN {
user <- Sys.getenv("COUCHDB_TEST_USER")
pwd <- Sys.getenv("COUCHDB_TEST_PWD")
(x <- Cushion$new(user=user, pwd=pwd))
# create a database first
if ("testing" %in% db_list(x)) {
invisible(db_delete(x, dbname="testing"))
}
db_create(x, "testing")
# get indexes
db_index(x, "testing")
# create indexes
body <- list(index = list(fields = I("foo")), name = "foo-index", type = "json")
db_index_create(x, "testing", body = body)
# get indexes, after creating another index
db_index(x, "testing")
# delete an index
res <- db_index(x, "testing")
db_index_delete(x, "testing", res$indexes[[2]]$ddoc, res$indexes[[2]]$name)
## and it's gone
db_index(x, "testing")
# }
Run the code above in your browser using DataLab