I have a query on mongoose
const result = await modelProfile.findOne(
{
_id: profileId,
},
{ 'payItems.ACId': 1 }
);
profile sample is
{
"firstName": "ABC",
"lastName": "DEF",
"payItems": [
{
"ACId": {
"$oid": "6168825c5d0edbc0b61615db"
},
"balance": 0,
"rate": 0
}, {
"ACId": {
"$oid": "6168825c5d0edbc0b61615dc"
},
"balance": 1,
"rate": 2
}]
}
when I ran it, it returns the following results that is correct:
{ payItems:
[
{ ACId: ObjectId("6168825c5d0edbc0b61615db") },
{ ACId: ObjectId("6168825c5d0edbc0b61615dc") }
]
}
That is correct, is there any way that I can MongoDB that I would like to return it "without keys" something like this (array of Ids)?
[
ObjectId("6168825c5d0edbc0b61615db"),
ObjectId("6168825c5d0edbc0b61615dc")
]