if (FALSE) {
# initialize a CouchDB connection
user <- Sys.getenv("COUCHDB_TEST_USER")
pwd <- Sys.getenv("COUCHDB_TEST_PWD")
(x <- Cushion$new(user = user, pwd = pwd))
row.names(mtcars) <- NULL
if ("bulktest" %in% db_list(x)) {
invisible(db_delete(x, dbname = "bulktest"))
}
db_create(x, dbname = "bulktest")
db_bulk_create(x, mtcars, dbname = "bulktest")
# modify mtcars
mtcars$letter <- sample(letters, NROW(mtcars), replace = TRUE)
db_bulk_update(x, "bulktest", mtcars)
# change again
mtcars$num <- 89
db_bulk_update(x, "bulktest", mtcars)
}
Run the code above in your browser using DataLab