I have two collection: 1.app which have documents like below example
{
"_id" : "1",
"app_name" : "Cab",
"active" : "A",
},
{
"_id" : "2",
"app_name" : "Gym",
"active" : "A",
}
2.category which has documents like below example
{
"_id" : "1",
"app_id" : 1,
"header" : "Request",
"onbehalf" : "N",
"project_onbehalf" : "N",
}
I want to perform something like
select app.app_id,app.app_name,category.header,category.onbehalf from app category where category.app_id=app._id AND app._id = "2"
EDIT
I have tried this query
db.category.aggregate([
{"$lookup": {
"from": "app",
"localField": "_id",
"foreignField": "_id",
"as": "R"
}},
{"$unwind": "$R"},
{"$project": {
"midEq": {"$eq": ["$M_id", "$R.app_id"]},
"app_id": 1, "app_name": 1
}},
{"$match": {
"$and": [
{"category_id": {"$eq": 6}},
{"midEq": {"$eq": True}}
]}},
{"$project": {
"midEq": 0
}}
])
But I am getting script executed successfully,but there are no result to show, After executing the query.
Any Help will be appreciable.
Thanks In Advance.