In the MongoDB console how can I remove a record by id? Here\'s my collection :
[
{
\"_id\" : { \"$oid\" : \"4d512b45cc9374271b02ec4f\" },
\"nam
Suppose we have this dummy collection:
{ "_id" : ObjectId("5ea53fedaa79db20d4e14284"), "item" : "planner", "qty" : 75 }
simply use:
db.inventory.deleteOne({ _id: ObjectId("5ea53fedaa79db20d4e14284") })
it will be deleted with this as a response:
{ "acknowledged" : true, "deletedCount" : 1 }
Thats it.