title: mongodb full $text search returns duplicate items when sorting and filtering
body: <p>I am using full-text search in my API and sorting using the score. The issue is after searching I usually get an item more than once and this is not the behaviour i expected. Please, how can i correct this?</p>
  <p>here is how my router is designed</p>
  <pre><code>router.get('/place', async (req, res) =&gt; {
      const match = {
          deactivated: false,
      }
      const sort = {}
  
      if (req.query.search) {
          match.$text = {$search: req.query.search}
          sort.score = {$meta: &quot;textScore&quot;}
      }
  
      const noOnPage = parseInt(req.query.limit) || 20
      const pageNo = (parseInt(req.query.page)-1)*parseInt(req.query.limit) || 0
      const endIndex = parseInt(req.query.page)*parseInt(req.query.limit)
      const next = parseInt(req.query.page)+1
      const previous = parseInt(req.query.page)-1
  
      try {
          const count = await Place.find(match).countDocuments().exec()
  
          const place = await Place.find(match, sort)
          .limit(noOnPage)
          .skip(pageNo)
          .sort(sort)
  
          const result = {}
  
          // Shows the search result count
          result.resultCount = count
  
          // Shows the previous page number
          if (parseInt(req.query.page)!=1) {
              result.previous = previous
          }
  
          // Shows the next page number
          if (endIndex &lt; count) {
              result.next = next
          }
  
          // assigns the search results to variable names results
          result.results = place
  
          res.status(200).send(result)
      } catch (e) {
          res.status(400).send({ &quot;message&quot;: &quot;something went wrong please reload page&quot; })
      }
  })
  </code></pre>