Answer the question
In order to leave comments, you need to log in
How to check all documents in a collection for uniqueness?
There is a collection with ~1kk documents of the form {_id: ObjectId, "id": "ID"}, you need to check all of them with each other to find out if all IDs are unique in this collection.
What is the best way to do this?
Answer the question
In order to leave comments, you need to log in
db.collection.find({}).count() must be equal to db.collection.distinct({"ID"}).length
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question