Book search, Parent & child mapping multiple author

Hi, I'm looking at at an example of Parent & child mapping with Book and Author. But how do I design index where a book has multiple authors and I'd like to search for books with certain tags and author.

Desired query:

  1. Find authors having name Mark or books having tag Y author X has co worked with. Will return all authors that user has worked with with name Mark or other authors in book with tag Y (not co worked with)
  2. Find all the authors with books having tag Y or Author name X
  3. Find all authors User has co authored with from publisher penguin

Example book:

{
 id: 1,
 authors: [1,2],
 tags: ['engineering', 'computer'],
 publisher:  'penguin'
}

Example author:

{
 id: 1,
 name: 'Mark Well'
}

Is it something possible with parent child mapping and if not, what would be ideal strategy?

I’d probably index books only and put all the authors details in the book document:

{
id: 1,
authors: [{
  id: 1,
  name: 'Mark Well'
  }
],
tags: ['engineering', 'computer'],
publisher:  'penguin'
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.