I am having one document,
{
"_id" : ObjectId("5bc864fe3cbb0d393687120b"),
"eStatus" : "y",
"aQuestions" : [
{
"eStatus" : "y",
"_id" : ObjectId("5bcd7818f0903a1c82aeef85"),
"sQuestion" : "aabbccdd?",
},
{
"eStatus" : "n",
"_id" : ObjectId("5bcda6aac272142b96ba77c3"),
"sQuestion" : "sdfdsf",
},
{
"eStatus" : "y",
"_id" : ObjectId("5bcda6bfc272142b96ba77c6"),
"sQuestion" : "vnmhjk",
},
{
"eStatus" : "n",
"_id" : ObjectId("5bd69f7516972c11234a3613"),
"sQuestion" : "What is use of Wallet in ParadiseXtrade ?",
}
],
}
My Query: helpFaqsModel.findOne({_id: req.body._id,aQuestions: {$elemMatch: {eStatus: "y"}}})
I am not sure what is the correct way to find the list of questions which has eStatus: "y"
I want to find the first document from the collection and from that collection which has eStatus:"y"