Reputation: 1164
I have 2 collections and i want to get distinct subject(chapter) in selected book
Books={title:string, Chaps:Chapters, date:date}
Chapters= {title:string, subject:string}
How to use
books.find(id:"5455545").populate('Chaps').distinct('Chaps.subject').exec(function (er,data){
console.log(data)
})
// i got this result => [] empty array
Upvotes: 2
Views: 255
Reputation: 76
You can't use that directly with mongoDB. Use an external filter.
Upvotes: 2