-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I was looking into replacing my custom baked design update functionality with this module but it is unusable for my task since it only detects changes to the views & updates fields.
FYI, I'm currently doing it like this, using the https://github.com/vkiryukhin/jsonfn-node module as a helper. Feel free to copy it if you want.
function updateDesign(db, name, design, cb) {
var id = '_design/'+name;
db.get(id, function(err, body, header) {
if (err && err.reason === 'missing') {
err = null;
body = {};
}
if (err) throw err;
var rev = body._rev;
delete body._id;
delete body._rev;
if (JSONfn.stringify(design) === JSONfn.stringify(body))
return cb(null);
// design is changed!
design._id = id;
design._rev = rev;
db.insert(new Buffer(JSONfn.stringify(design)), id, cb);
});
}Metadata
Metadata
Assignees
Labels
No labels