javascript - Meteor.js update only one parameter instead of whole collection -


i'm trying mark message readed using code below :

template.fullmessage.onrendered(function () {             var id = flowrouter.getparam('id');             messages.update(id, {$set: {readed: true} }); }); 

collection :

"_id": "ymxyn9nodpezqfp83",   "whatabout": "adsfadsfasdf",   "message": "sdfadsfadfadsfasdfasdf",   "recipientid": "9ewif8jtnp77pmijw",   "author": "9ewif8jtnp77pmijw",   "createdat": "2016-05-09t08:37:52.282z",   "owner": "seofilms",   "readed": false } 

i expected column "readed":"false" replaced "readed":true,

but instead of it, in here changing, including owner. instance if open message user test, change owner of message.

why happens ?

is possible prevent sending whole object , change id?

thank ideas.

try this:

messages.update({_id: id}, {$set: {readed: true} }); 

it should work id, you're doing. there other code that's writing same collection? try run in console , check if it's still updating properties.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -