根据字段从数据库中删除重复项

时间:2015-04-27 21:40:50

标签: mongodb

所以我有一个包含这样的文档的集合: Data 现在,一些文档具有相同的'dmca.id'字段(这不是由mongodb分配的id),即它们是重复的,我想删除它们并且只保留一个副本。有超过400万份文件,所以我希望以最快的方式。我的mongodb版本是3.0.2。我看到一篇文章删除了重复项,但仅对版本2.x有效。 根对象名称不一定是dmca,也可以是其他内容

{"dmca":{"id":407,"type":"Dmca","title":"DMCA (Copyright) Complaint to Google","body":null,"date_
{"dmca":{"id":408,"type":"Dmca","title":"BPI DMCA (Copyright) Complaint to Google","body":null,"d
{"dmca":{"id":409,"type":"Dmca","title":"Music DMCA (Copyright) Complaint to Google","body":null,
{"dmca":{"id":410,"type":"Dmca","title":"DMCA (Copyright) Complaint to Google","body":null,"date_
{"dmca":{"id":411,"type":"Dmca","title":"Stealth v. Stealth Signal","body":"Dear President:\r\n\r

0 个答案:

没有答案