I have following document
{
"_id": "9036472948305957379",
"_rev":"162de87a696361533791aa7",
"firstname":"xyz",
"lastname": "abc"
}
Now I want to update above dosument to following
{
"_id": "9036472948305957379",
"_rev":"162de87a696361533791aa7",
"name":"xyz abc"
}
if I do doc['name'] = "xyz abc" it doesnt remove firstname and lastname attributes. how do I achieve that?
You need to explicitly remove the
firstnameandlastnameproperties from your local copy of the document before saving it back in the database.If I understand your issue correctly you are currently sending the following document body (implicitly or explicitly) to the database when you initiate the update operation:
However, your payload needs to look as follows:
If you are using the
python-cloudantlibrary take a look at thefield_setmethod at http://python-cloudant.readthedocs.io/en/latest/document.html: