I have the following Schema set up on mongoose
{
_id:
store:
offers:[{
name:
price:
}]
}
I decided to indexed offers.name as follows
uniSchema.index({'offers.name':'text'});
and now I'm trying to do searches on that index
Stores.find({$text:{$search:VALUE}}, callback);
But this way whenever there's a hit on the search the whole store is listed, and I'm unable to figure out from which offer the match came from.
Is there a way to do this with indexes on mongoose? Figuring out which array element matched the query?