Consider the following MongoDB \"recipes\" collection:
{ \"title\" : \"Macaroni and Cheese\", \"ingredients\" : [ { \"name\" : \"noodles\", \"qty\" :
Use distinct to find an array of distinct values for ingredients.name
distinct
ingredients.name
db.recipes.distinct('ingredients.name')
yields [ "butter", "cheese", "noodles", "flour", "sugar", "water" ]
[ "butter", "cheese", "noodles", "flour", "sugar", "water" ]