Learn R Programming

sofa (version 0.4.2)

db_create: Create a database.

Description

Create a database.

Usage

db_create(cushion, dbname, delifexists = FALSE, as = "list", ...)

Value

JSON as a character string or a list (determined by the as parameter)

Arguments

cushion

A Cushion object. Required.

dbname

Database name

delifexists

If TRUE, delete any database of the same name before creating it. This is useful for testing. Default: FALSE

as

(character) One of list (default) or json

...

Curl args passed on to HttpClient

Examples

Run this code
if (FALSE) {
user <- Sys.getenv("COUCHDB_TEST_USER")
pwd <- Sys.getenv("COUCHDB_TEST_PWD")
(x <- Cushion$new(user = user, pwd = pwd))

if ("leothetiger" %in% db_list(x)) {
  invisible(db_delete(x, dbname = "leothetiger"))
}
db_create(x, dbname = "leothetiger")

## see if its there now
db_list(x)
}

Run the code above in your browser using DataLab