I have an MongoDB object like:
{
"user" : ObjectId("60e5f88159292f575c0ca17f"),
"questions" :[
{
question 'aaaaaaa',
id :'1'
},
{
question 'bbbbbbb',
id :'2'
},
{
question 'ccccccc',
id :'3'
}
]
}
I want to pass an array of questions id ['1', '3'] and user object id. I want to fetch the question which matches the questions id and user.
My expected output should look like this:
{
"user" : ObjectId("60e5f88159292f575c0ca17f"),
"questions" :[
{
question 'aaaaaaa',
id :'1'
},
{
question 'ccccccc',
id :'3'
}
]
}
How can I do this?