I have a database in MongoDB of several movies with information about them (actors who participated, genre, year, etc). I need a list without repeats of the actors who made comedy movies in 1993. I think I have the code to get all the actors that meet this condition, but if an actor participated in two comedy movies from 1993, then he will appear twice in my list.
Query:
db.movies.find({genre: "Comedy", year:1993},{actors:1})
With db.collection.distinct() you get the values without duplicates of a field. Allows you to pass a query like the one you used as the 2nd parameter.