count distinct on mongodb code example
Example 1: mongodb count distinct
db.collection.distinct('field').length
Example 2: find distinct in mongodb
db.inventory.distinct( "item.sku", { dept: "A" } )
db.collection.distinct('field').length
db.inventory.distinct( "item.sku", { dept: "A" } )