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)

原文地址:https://www.cnblogs.com/xingxingge/p/14726166.html