I am trying to create a visualization in redash using mongo query, for few ids.I am trying to add multiple ids inside match , but its giving error, how we can give a list of object ids to match
{
"collection": "abc",
"aggregate": [
{
"$match": {
"_id": {
"$in": [
"$oid":"65372536"
]
}
}
},
{
"$unwind": {
"path": "$rest",
"preserveNullAndEmptyArrays": true
}
},
{
"$project": {
"_id": "$_id",
"name": "$rest.name",
"age": "$rest.age"
}
}]}
how can I give multiple object ids inside match
solved this question by adding {} for object ids
{
"collection": "abc",
"aggregate": [
{
"$match": {
"_id": {
"$in": [
{"$oid":"65372536"},
{"$oid":"67468299"},
{"$oid":"69087654"}
]
}
}
},
{
"$unwind": {
"path": "$rest",
"preserveNullAndEmptyArrays": true
}
},
{
"$project": {
"_id": "$_id",
"name": "$rest.name",
"age": "$rest.age"
}
}]}