How do we query in mongo where in the results would not have duplicates , I have tried using distinc but it does not seem to work.
keystone.list('Customer').model.find().sort('name').where('vin').in([vin]).exec(
function (err, results) {
if (err || !results.length) {
return next(err);
}
.....
keystone.list('Customer').model.find().distinct('customer_id')
.where('fieldName', 'fieldValue')
.exec(function(err, result) {
//array of _ids
});
Then pass all the ids in a $in
query to get all the records.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.