unable to insert json object inside another in node.js -
usersmodel.findone({"username":username}).exec(function (err, users) { if (err) { logger.info("my error "+err); return res.status(500).send(err); } else if(!users) return res.status(404).send('no user found'); else { users["account"]="xxxxxxxxx"; return res.status(200).send(users); } });
i want insert account key pair value inside users json.but return users json not contain account fields.where issue ?
Comments
Post a Comment