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
Post a Comment