I have a collection with objects with a json output like this:
{
"_id": {
"$oid": "53107ed2e6fb449fa641b903"
},
"title": "myBook"
}
But I would like to get this:
{
"_id": "53107ed2e6fb449fa641b903",
"title": "myBook"
}
I have tried with dot notation and $project but it doesn't work:
db.books.aggregate({
$project: {
_id: "$_id.oid",
title: 1
}
)