Learn R Programming

couchDB (version 1.4.1)

couch_new_object: New couchDB document

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

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

Run this code
## 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) 

Run the code above in your browser using DataLab