javascript - Is it possible to insert(not update) a field name as variable in Mongodb? -


im trying insert embedded document in mongodb meteor project.

'submit form' : function(event){   event.preventdefault();   var query=document.getelementsbyclassname("twilioprocessorsms")[0].value;   choicelist.insert({   sms: esms,   query: {   accountsid: accsid,   authtoken: token,   phonenumber: phno}     }); 

i trying have "query" variable. considers query string.i dont want achieve update. pls !

something should work:

'submit form' : function(event){    event.preventdefault();    var query=document.getelementsbyclassname("twilioprocessorsms")[0].value;        var valuetoinsert = {      sms: esms    };    valuetoinsert[query] = {      accountsid: accsid,      authtoken: token,      phonenumber: phno}      };        choicelist.insert(valuetoinsert);


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -