Remove only one document in MongoDB

后端 未结 9 2002
日久生厌
日久生厌 2021-01-12 23:42

when I call

db.collection.remove({\'condition\':\'some condition\'});

This one line will delete all the matching condition documents.

9条回答
  •  生来不讨喜
    2021-01-12 23:58

    To remove one document from collection use the bellow command

    db.collectionname.remove({"_id": ObjectId("5473293d43ecdre56352457f3a")})

提交回复
热议问题