mongoose count distinct documents 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" } )