Basic question on mongosh vs Mongo DB Compass

Hello
I dont understand why when I run this query in mogosh, I have the count result which is displayed and why when I run it in DB Compass nothing happen
What is wrong please?

db.aa.countDocuments({"borough":"Bronx"})

Hello :wave: @jip31,

Could you please share the screenshot of the MongoDB compass and mongosh?

Also, share the log file snippet from the MongoDB Compass after executing this query to better understand the issue. You can find the log file from Help → Open Log File

Best,
Kushagra

Hi
Here is the screenshots

Thanks

Hi @jip31,

Thanks for sharing the screenshot.

In MongoDB Compass, when you run a query you see the number of results without the need for a count.

For example, input the following query

{"borough":"Bronx"}

and you will see the total count of documents as shown in the screenshot.

I hope it answers your question.

Best,
Kushagra

Thanks a lot
Sorry I work on Mongo DB since 2 days and I try to understand :wink:

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