Mondb remove justOne

删除复合条件的一行记录可以用如下语法:

db.test.remove({C_ID:"2"},1)

如果是分片环境

mongos> db.test.remove({CT1:"2"},1)
can only delete with a non-shard key pattern if can delete as many as we find : { CT1: "2" }
mongos> db.test.remove({C_ID:"2"},1)
mongos> db.test.remove({C_ID:"2"},1)
mongos> db.test.remove({C_ID:"2"},2)

posted @ 2021-05-02 18:56  hexel  阅读(63)  评论(0编辑  收藏  举报