Let's say I have an Document like so.
const User = {
info: {
id: 123,
},
data: {
111:{},
123:{value: 5},
234:{value: 10},
}
}
And I want to preform and aggregation that can check if 'data.123.value' is greater than 10.
Is something like that possible with mongo? This is what I have so far, but it's not working.
aggregate([
{
$project: {
UserId: '$info.id',
}
},
{
$match: {
'data[$UserId].value: {$gt: 10},
}
}
]
I can do some server side work to preform this operation, but i would be really cool if mongo could just do this for me.
Any help is appreciated!