Steps to Delete a Single Document Using deleteOne() in MongoDB
1). Open the MongoDB Shell using mongosh.
2). Select the database using use database_name.
3). Check the existing documents using find().
4). Use the deleteOne() method to delete a specific document.
5). Provide a filter condition to identify the document to be deleted.
6). Execute the deleteOne() command.
7). Verify the deletion using find().
Example
use studentdb
db.students.deleteOne(
{ name: "John" }
)
db.students.find()