how can i get all distinct documents from mongodb collection using mongoose query? when I use distinct with find query I'm getting array of distinct elements of the given field.
MyModel.find().distinct('_id', function(error, ids) {
// ids is an array of all ObjectIds
});