Update value in array in Mongodb using Meteor gives error 403 -


i hope can me problem of mine. please forgive me if i'm not expressing correctly want.

i have mongodb collection arrays holding objects , need change value of 1 of these objects variables. found correct answer in mongodb when using in meteor complain being able update _id

my collection this

{   _id: 'akjsdakudsh',   subs: [     {       name: 'name1',       seen: false,     },     {       name: 'name2',       seen: false,     }   ] }, {   _id: 'ako0iqwjeqasdf',   subs: [     {       name: 'name1',       seen: false,     },     {       name: 'fantastic',       seen: true,     }   ] } 

therefore if want change seen true 1 called name2 in mongodb

db.coll.update(     {         _id : 'akjsdakudsh',         'subs.name': 'name2'     },     {         $set: { 'subs.$.seen': true }     }   ); 

and works charm. problem comes when trying in meteor because throw error 403 not permitted. untrusted code may update documents id.

i understand problem don't have _id array's elements, , don't need else.

any ideas on doing wrong or neat workaround solve problem? appreciated, thank you.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -