cdbAddDocS: This function adds multiple database documents with one...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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)

R4CouchDB documentation built on May 2, 2019, 6:05 a.m.