Hi,
I running nodejs - mongoUpdate function with:
let uresult = await mongo_dal.mongoUpdate({"_id": user._id}, {"sent": user.sent });
console.log(uresult.result.nModified);
async function mongoUpdate(query, newData){
try{
let result = new Promise((resolve, reject)=>{
const users = db.collection('users').updateOne(query,{$set: newData}, function(err, docs) {
if (err) {
reject(err);
} else {
resolve(docs);
}
});
});
return result;
}catch(err){
console.error(err);
return err.message;
}
}
on the “uresult.result.nModified” I got 1 - looks like all right and updated.
but really the data not updated!
the problem happens not always…
Please help me to solve this…