my code is :
result = await mongoDBO.collection(collectionName).find({id: data.id},{projection : {'_id' : 0}}).toArray();
But I get the following error
Unsupported projection option: projection: { _id: 0 }
CodePudding user response:
Remove projection
property. Just send the projection object:
result = await mongoDBO.collection(collectionName).find({ id: data.id }, { '_id': 0 }).toArray();
CodePudding user response:
I also tested this way and it worked
await mongoDBO.collection(collectionName).find({id:data.id}).project({'_id' : 0}).toArray()