Remove only one document in MongoDB

后端 未结 9 2028
日久生厌
日久生厌 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:52

    Can't you just run a find first to get the id then a delete when you have the one you want?

提交回复
热议问题