cdbAddDoc: Generates a new document

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

Description

This function adds a new document to an already existing database

Usage

1
cdbAddDoc(cdb)

Arguments

cdb

The list cdb only has to contain a cdb$dataList which is not an empty list().

Details

This function is called addDoc (which means add a new document). Therefore the cdb$id is requested using cdbGetUuid() for every document to add if no cdb$id is provided. If a cdb$id is provided the function fails when a document with the given id already exists. In this case one should use cdbUpdateDoc(). Since version v0.6 the function writes the _rev and _id key to the top level of cdb$dataList.

Value

cdb

The couchdb response is stored in cdb$res

Author(s)

wactbprot

See Also

cdbGetDoc()

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
ccc               <- cdbIni()
# I assume a database at localhost:5984 already exists
ccc$DBName        <- "r4couchdb_db"
ccc$dataList      <- list(normalDistRand =  rnorm(20))
ccc               <- cdbAddDoc(ccc)


## End(Not run)

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