I tried
dropDups: true
but it is not working, is there any other way to remove duplicates from mongo collection?
And how to assign unique key to particular field?
I tried
dropDups: true
but it is not working, is there any other way to remove duplicates from mongo collection?
And how to assign unique key to particular field?
dropDupes is deprecated after 2.7
You can go for Aggregation and write script to remove dups. Or else you can get a dump of that collection then remove all documents from that old collection. after that add unique index to the collection and then restore the collection back. mongoresore will not add duplicate collections.