How to find all Book with Author condition in collection-helpers package?

I would like to find all Book that Author condition of gender = “Male”.

books: function () {
        return Books.find({
            "author.gender": 'M'
        });
    }

pl help me.

The good solution:

books: function() {
  var authorIds = Authors.find({ gender: 'M' }).map(function(author) { return author._id; });
  return Books.find({ authorId: { $in: authorIds }});
}

In my opinion, your first code should work, no need for the second one.

I don’t think your question relates to the collection-helper package, does it? You might want to change the title of your question.

I don’t to use embed document.
I have two collection Books and Authors, and then want to get all books with gender = “M” of author condition.
I think that the second code it is slow and difficult to manage the many relation of collection