Saturday, 6 May 2017

Add new fields to CouchDB document

Currently, I'm used to update fields into document. In order to do this, I use the "put" function.

For example :

res._rev = res._rev;
res.sexe = qresults[0].sexe;
res.boursier = qresults[0].bourse;
res.code_postal = qresults[0].code_postal;
res.handicap = qresults[0].Handicap;
db.put(res).then((result) =>{
    console.log(result);
}).catch(function (err) {
    console.log(err);
});

My question is : what if the field res.boursier doesn't exist ? Actually I got no error but nothing change in my database.

I'm using Node.js, pouchDB and Cloudant



via Stephane Karagulmez

No comments:

Post a Comment