if (FALSE) {
if (interactive()) {
## create a connection
user <- Sys.getenv("COUCHDB_TEST_USER")
pwd <- Sys.getenv("COUCHDB_TEST_PWD")
(x <- Cushion$new(user = user, pwd = pwd))
# Create a database locally
db_list(x)
if ("hello_earth" %in% db_list(x)) {
invisible(db_delete(x, dbname = "hello_earth"))
}
db_create(x, "hello_earth")
## replicate to a remote server
z <- Cushion$new(host = "example.com", transport = "https", port = NULL)
## do the replication
db_replicate(x, z, dbname = "hello_earth")
## check changes on the remote
db_list(z)
db_changes(z, dbname = "hello_earth")
## make some changes on the remote
doc_create(z,
dbname = "hello_earth",
'{"language":"python","library":"requests"}', "stuff"
)
db_changes(z, dbname = "hello_earth")
## create another document, and try to get it
doc_create(z,
dbname = "hello_earth", doc = '{"language":"R"}',
docid = "R_rules"
)
doc_get(z, dbname = "hello_earth", docid = "R_rules")
## cleanup - delete the database
db_delete(z, "hello_earth")
}
}
Run the code above in your browser using DataLab