couch_new_object: New couchDB document

Description Usage Arguments Examples

Description

Creates a new object to to insert to the couchDB. Takes either a list or a formatted json object as value Any attachment to the record needs to be base64-encoded added to the list as "_attachments" If key is provided this is used, null sends a key-less record to couch and the key will have to be retrieved from the response object.

Usage

1
couch_new_object(value, database = NULL, key = NULL)

Arguments

value

List to be converted to json for transmission or pre-formatted JSON string

database

The database to use

key

The key (recordname) to use for the object.

Examples

1
2
3
4
5
6
7
8
9
## Not run:  
   # This code creates a document containing a small list for storage in 
   # the "localhost" database with the key "testDoc".
   myDoc <- couch_new_object(list(a = 1,b = 2),"localhost","testDoc") 
   
   # Same as above but with json entered directly (not recommended).
   myDoc <- couch_new_object('{"a":1,"b":2}',"localhost","testDoc")

## End(Not run) 

couchDB documentation built on May 2, 2019, 4:09 a.m.