var sellReportData = await SingleDigit.aggregate([
{
"$lookup":{
"from":"bidhistories",
"let":{
"number":"$single_digit"
},
"pipeline":[
{
"$match":{
"$expr":{
"$and":[
{
"$eq":[
"$digits",
"$$number"
]
},
{
"$eq":[
"$game_id",
"game_name"
]
},
{
"$eq":[
"$session",
"market_status"
]
},
{
"$eq":[
"$bid_date",
"bid_date"
]
},
]
}
}
},
{
"$group":{
"_id":"$digits",
"totalAmount":{
"$sum":"$points"
}
}
}
],
"as":"sellReport"
}
},
{
"$sort":{
"sellReport.totalAmount":-1
}
}
])
The code that is bold in this query is must for me as where condition with join table but when i am using this then i am not able to fetch data whatever i am looking for can anybody help me what i am doing wrong in this.
Thanks in advance.