I have a json aggregation query that I would like to convert into c# using the linq or aggregate fluent syntax:
db.getCollection('customers').aggregate(
[
{ $match:
{ $and:
[
{ RegistrationDate: { $lte: ISODate('2021-12-13T23:59:59.999Z'), $gte: ISODate('2011-11-22T00:00:00.0Z') }},
{ $or:
[
{ CountryOfResidence: 'France'},
{ CountryOfResidence: 'Spain'},
]
},
{ Age: {$gte: '40'}}
]
}
},
{ $group: { _id: '$LastName', count: { $sum: 1 }, data: { $push: '$$ROOT' } } },
{ $match: { count: { $gte: 2 } } }, { $project: { count: 0 } }
])
Can somebody show me please what is the equivalent of the above json query containing $push: ‘$$ROOT’ when using the c# driver?