javascript - update by id not working in mongoose -
i have code in making new connection using mongoose , using schema also. connection made , im getting attributes collection. after want update in collection, , not working.. have following code
console.log("id : "+content._id); alert.findbyidandupdate(content._id, { $set: { status: true } }, function(error, result) { console.log(result); if (error) console.log(error); else { console.log('alert updated'); } });
it shows alert updated status remains false..
result 1st console id : 55096a5f91169c8e1673af20; , 2nd console alert updated
thanks , regards in advance
your code looks perfect, id looks it's correct , code don't return erros, so,
have checked schema see if contains "status" field?
looks can create , edit new documents schema not equal on both sides, application data layers.
more info here: https://github.com/automattic/mongoose/issues/1060
hope i've helped.
Comments
Post a Comment