javascript - How to access value of variable in Mongo? -


var = "act"; db.s.findone( {    brandid: doc.brandid,     : {$exists:false}  } ).a; 

i try pass value of variable "a" mongoscript. looks can not used. can help?

build query step step , not use . use [] instead

var = 'act'; var query = {brandid: doc.brandid}; query[a] = {$exists:false}; db.s.findone(query)[a]; 

note:

query.act == query['act']. 

just javascript tricks.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -