【发布时间】:2017-03-15 01:08:41
【问题描述】:
我有这样的对象集合:
{"_id":"...", "user":"foo", "value":"a"}, // this one stays coz its user is foo
{"_id":"...", "user":"bar", "value":"a"}, // remove this one
{"_id":"...", "user":"baz", "value":"a"}, // remove this one
{"_id":"...", "user":"qux", "value":"b"}, // this one has unique value so it doesn't get deleted
我想查找并删除所有具有重复值的对象,除非用户是foo。
有 JS mongoshell 方法吗?
【问题讨论】:
标签: javascript mongodb mongo-shell