I'm new to MongoDB
I tried the findOne function, but it does not work the way I want it
client.db("game").collection("players").findOne({ _id: "s1" }, { data: 1, _id: 0 })
I want it to return only the data field without the _id
but it returns:
{
_id: 's1',
data: [somedata...]
}
My data is look like this (From MongoDB Compass):
CodePudding user response:
In MongoDB Version 5.0.6 the MongoDB query is working fine Output Of The Query