![]() |
VOOZH | about |
distinct() method in MongoDB is used to retrieve all unique values for a specified field from a collection. In Python, you can use this method with PyMongo to filter out duplicates and get a list of distinct values across documents. This is helpful when you want to find all unique fields without repeating values.
collection.distinct(key, filter=None)
Parameters :
Output
In this Example, distinct() method is used to return unique values of different fields from the collection.