Chris
Chris

Reputation: 23

How to update document field in IBM cloudant nosql

I'm trying to update a single field in my document using BlueMix Cloudant Nosql. The problem I'm facing is that I'm just overriding the whole document and not updating the single item or list of items. What is the proper way to execute the HTTP PUT command to do this? I'm new to both JSON and Nosql.

{
"_id": "2c314478997815d6e4037c0b1a848678",
"_rev": "10-a965f79ad26a23796cd331e6b1a04378",
"organization": "BusinessName",
"email": "emailaddress"
}
curl -X PUT -H "Content-Type: application/json" HTTP1.1 '<Address>/<db>/<document> -d '{
"organization": "New Data",
"_rev": "<rev_id>"}'

Upvotes: 1

Views: 860

Answers (1)

Ram Vennam
Ram Vennam

Reputation: 3546

Cloudant is based on the Apache-backed CouchDB project and the open source BigCouch project.

You can not do partial updates in CouchDB. Get the document, update locally and push the whole doc back using PUT and the right _rev

Upvotes: 2

Related Questions