Last data update: 2014.03.03

R: This function adds multiple database documents with one...
cdbAddDocSR Documentation

This function adds multiple database documents with one request

Description

This is done via the _bulk_docs API provided by an already existing database.

Usage

cdbAddDocS(cdb)

Arguments

cdb

cdb$dataList has to be a list of lists, cdb$DBName, cdb$serverName is needed.

Details

The _bulk_docs endpoint requires that cdb$dataList resolves to an json array. This is reached with e.g. cdb$dataList <- list(list(...),list(...),...). Furthermore, _bulk_docs requires the documents to be wrapped in a key named docs:[...]; this is done by cdbAddDocS() if cdb$dataList is a list of lists. The user dont need to care.

At the moment the resulting _rev and _id will be not written back to the cdb$dataList. This means that a second call of cdbAddDocS() generates new Documents.

Value

cdb

The couchdb response is stored in cdb$res

Author(s)

parisni, wactbprot

See Also

cdbAddDoc()

Examples

## Not run: 
ccc               <- cdbIni()
# I assume a database at localhost:5984 already exists
ccc$DBName        <- "r4couchdb_db"
docs <- list()
for(i in 1:10){
 docs[[i]] <- list(normalDistRand =  rnorm(20))
}
# docs is noe a list of 10 lists
ccc$dataList <- docs
# generating 10 database documents
cccAddDocS(ccc)$res

## End(Not run)

Results