Problems using meteors upsert -


using meteor@1.1.0.2 , doing upsert on server side gives me problems. either complains syntax wrong insert or update, or doing wrong?

the code below work on inserts on updates throw:

error: update parameter cannot have both modifier , non-modifier fields.

mail.upsert({ ma_user_id: userid }, {   ma_user_id: userid,   ma_address: useremail,   ma_verified: false }, function (e, r) {   console.log(e, r); }); 

the code below works on updates throw error on inserts: mongoerror:

the dollar ($) prefixed field '$exists' in 'removed.$exists' not valid storage.

mail.upsert({ ma_user_id: userid }, { $set: {     ma_user_id: userid,     ma_address: useremail,     ma_verified: false   } }, function (e, r) {   console.log(e, r); }); 

i have tried gives me error on update:

error: update parameter cannot have both modifier , non-modifier fields.

mail.update({ ma_user_id: userid }, {     ma_user_id: userid,     ma_address: useremail,     ma_verified: false   }, {     upsert: true   }, function (e, r) {     console.log(e, r);   }); 

the error message says cannot use same field in both selector , modifier. have remove ma_user_id modifier this:

mail.upsert({ ma_user_id: userid }, {         ma_address: useremail,   ma_verified: false }, function (e, r) {   console.log(e, r); }); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -