Am currently writing a query that displays info on trucks with specific registration numbers but am not allowed to show the object id within my query. So far I am able to get the desired output but despite putting "_id":0 in my query, the object ID is still present during my query.
[Query]
db.transport.find(
{
$or:[
{"TRUCK.registration":"PKR768"},
{"TRUCK.registration":"PKR008"},
{"TRUCK.registration":"SST005"},
{"_id":0},
]
}
).pretty()
[Output]
{
"_id" : ObjectId("5fab387f48a75b7c08cedfe4"),
"TRUCK" : {
"registration" : "PKR008",
"capacity" : "22000",
"weight" : "8800",
"status" : "AVAILABLE"
}
}
{
"_id" : ObjectId("5fab387f48a75b7c08cedfe5"),
"TRUCK" : {
"registration" : "PKR768",
"capacity" : "1234",
"weight" : "3000",
"status" : "AVAILABLE"
}
}
{
"_id" : ObjectId("5fab387f48a75b7c08cedfe7"),
"TRUCK" : {
"registration" : "SST005",
"capacity" : "12000",
"weight" : "50000",
"status" : "USED"
}
}