Say that there is a couchdb session opened through nano on node.js
var dbserv = require('nano')('http://localhost:5984');
At the couchdb server dbserv
can access, there is a database users
with users that have a field groups
that is an array.
If I wanted to update groups
on a user jim
in users
, how would I do so without replacing the entire document?
CouchDB
To create an update handler, write a design document:
and PUT it in your db with the id
_design/yourapp
, then GET it like this:nanocouch
Note that you need to insert the design document only once, you can even do it manually using
curl
, then to update your docs just make a GET request as explained above.Disclaimer: untested and I never used nano before, but it should be on the lines of what you have to do.