Closed Nesh108 closed 10 years ago
Any info?
couchbeam_doc:set_value does that. If you wan't atomic updates of a field in a doc this isn't possible yet with the couchdb api.
Matybe there could be an update function allowing you to walk in a doc and replace values if needed. Would it be useful?
The module couchbeam_doc already offer a bunch of functions allowing to manipulate the JSON objects. You can, set,delete,extend,fet,or take a value from them. About the latest feature it should be done at app level imo. Though an interresting feature could be adding a way to "patch" a doc.
Anyway closing this issue since most is already addressed.
As there is a function for deleting a single field of a doc, it would be very useful to have a function for updating just one field.
It would be also interesting to have a similar function which just is used for incrementing the value by a certain amount, for instance:
"counter" = 1
update_field("counter", 1, increment)
"counter" = 2
update_field("counter", 5, increment)
"counter" = 7
update_field("counter", 6, decrement)
"counter" = 1