I want to retrieve distinct records from mongodb .I tried the below method,
Model.find()
.distinct('username')
.where({ age: 21 })
.exec(function(err, user) { });
But iam getting error as below.
TypeError: Object [object Object] has no method 'distinct'.
Please help.