Reputation: 7140
I have the following schemas
var book_s = new Schema({
//_id: automatically generated,
pageCount: Number,
titles: [{ type: Schema.Types.ObjectId, ref: 'BookTitle' }]
});
var bookTitle_s= new Schema({
//_id: automatically generated,
language: String,
title: String
});
If I use a query like the following: Book.find({}).populate('titles').exec()
I will get a list of all titles for each book.
Is there a way to alter the query so that I can pass in a language paramater (say, English), and populate only the English titles into the Book model?
Upvotes: 0
Views: 47