Count( ) in data explorer Atlas

Learning to filter using the data explorer ATLAS,
how to do count( ) on ther filtered result?
We only get the total document (above the filter text box) and 1-20 of MANY but not how many filtered result in total.
So far Julia has explained count( ) in mongo shell.

Welcome back @yogiHalim .

Well, If you watch that lecture again in which Julia explains count() she explicitly says It is one of the advantage of using mongo shell.

Data explorer is just GUI where you can perform actions by clicking not by writing queries. Thanks

So, in short, cannot count filtered result in data explorer Atlas?

Thanks for responding.

There is a way to do it.

But you need to use in the aggregation.

Rather than

db.collection.count( Query )

you ran the aggregation

[ { "$match" : Query } , { "$count" : "number of documents" } ]

Aggregation is covered later in the course. I just mentioned it so that you do not get the wrong impressions. It is possible to get a count from both Atlas and Compass GUI.

2 Likes

Completed the aggregation format chapter 5 earlier, so I somewhat understand $match,
but cannot get $count to work.
What is “number of document” on your syntax {$count:“number of document”},
and where will the count result displayed in the data explorer Atlas?

I cannot write better than the documentation:

image

Yes, I also just found out that you meant on the aggregation tab, which is actually a shell command.
(instead of counting filter result on the documents tab)
Thanks for taking the time explaining.

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