Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Atlas Search
Created by Guest
Created on Oct 7, 2019

Return the amount of results in a Search query

I don't think there's currently a way to see this today? Seems like a missing basic feature.
  • Guest
    Mar 24, 2020
    Its an aggregate pipeline so you can just add a $count pipeline step after the query. If you want the results and the count in the same query then use a facet and a $count like so: ``` db.example.aggregate([ { $searchBeta: { ... } }, { $facet: { results: [{ $project: { ... } }], total: [{ $count: "total" }] } } ]) ```