cdbAddDoc {R4CouchDB}R Documentation

Generates a new document

Description

This function adds a new document to an already existing database

Usage

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

## 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)

[Package R4CouchDB version 0.7.5 Index]