Hi Team,
Could someone help to fetch particular keys instead of entire object.
using await collection.find({_id: {’$in’: _ids }}).toArray(); to fetch entire object. Is there way to filter only 2 of the keys from that object.
Object :
[
{
"_id": “abc”,
“key1”: “value”,
“key”2: “some value,
“req1”: 1,
"req2”: “222”
},
{
"_id": “xyz”,
“key1”: “value”,
“key”2: “some value,
“req1”: 2,
“req2”: “333”
},
]
instead of entire object, can we have
[
{ "req1": 1,
"req2": 222
},
{ "req1": 2
"req2": 333
}]
Note: used project to achieve that but not seen any performance.
could anyone help any other better approach?
Thanks