I want to be able to pass a dynamic BSON variable to match for mongodb.
Here is what I have tried:
var query = "\"info.name\": \"ABC\"";
and
var query = {
info: {
name: "ABC"
}
}
Neither of these work when passing variable 'query' to match (like below):
$match: {
query
}
but explicitly passing like below does work:
$match: {
"info.name": "ABC"
}