title: Query in nested document in mongodb
body: <p>Here is my mongoose schema:</p>
  <pre><code>const chapterSchema = mongoose.Schema({
  title: {
      type: String
  },
  number: {
      type: Number
  }
  })
  
  const bookSchema = mongoose.Schema({
      title: {
          type: String
      },
      author: {
          type: String
      },
      chapters: [chapterSchema]
  })
  
  const Book = mongoose.model('Book', bookSchema)
  module.exports = Book
  </code></pre>
  <p>Here is my database:</p>
  <pre><code>{
  &quot;_id&quot;: &quot;5f56f8e66a7eee227c1acc0a&quot;,
  &quot;title&quot;: &quot;Book1&quot;,
  &quot;author&quot;: &quot;Author1&quot;,
  &quot;chapters&quot;: [{
      &quot;_id&quot;: &quot;5f56fa47a78fbf03cc32d16d&quot;,
      &quot;title&quot;: &quot;Chapter1&quot;,
      &quot;number&quot;: 1
  }, {
      &quot;_id&quot;: &quot;5f56fad10820300de031317f&quot;,
      &quot;title&quot;: &quot;Chapter2&quot;,
      &quot;number&quot;: 2,
  }]
  }
  </code></pre>
  <p>I want to find a specific chapter from the <em>chapters</em> array by it's id. So, I wrote this code:</p>
  <pre><code>router.get('/:id', async function (req, res) {
  try {
      const id = req.params.id
      await Book.findById(id, function (err, chapter) {
          res.render('chapter.hbs', {
              chapter: chapter
          })
      })
  } catch (error) {
      res.redirect('/')
  }
  })
  </code></pre>
  <p>According to the chapter id, I want this result:</p>
  <pre><code>{
      &quot;_id&quot;: &quot;5f56fa47a78fbf03cc32d16d&quot;,
      &quot;title&quot;: &quot;Chapter1&quot;,
      &quot;number&quot;: 1
  }
  </code></pre>
  <p>or</p>
  <pre><code>{
      &quot;_id&quot;: &quot;5f56fad10820300de031317f&quot;,
      &quot;title&quot;: &quot;Chapter2&quot;,
      &quot;number&quot;: 2,
  }
  </code></pre>
  <p>What should I do to find a specific chapter using it's id?</p>