Hi everyone ! I am facing issue in connecting the database server

Hi everyone ! I am facing issue in connecting the database server

Post a screenshot of what you are doing that shows the issue you are having.

My count( ) line returned random text (circled red in attached screenshot).
Even pressing enter returned random text, earlier no rendom text.
Is this related to server issues mentioned in this thread?

Hello @yogiHalim ,

Welcome to the MongoDB Community Forums.

You are using the query wrong. It must be


not the other way around. Thanks

Just to let you know the syntax

db.CollectionName.count( Query )

is valid in both mongo and mongosh CLI. See:

Hi Zaib,

db.collection_name.count( ) works.
You should try it.

My question was about random text appearing even if I only pressed enter multiple times on the shell as shown at the bottom of my screenshot earlier.

Are you still getting that random text if you exit shell,reconnect and try a query followed by enter

Thanks for letting me know. learned something new today :sunglasses:

After exiting shell and reconnect, all back to normal.
Then after querying long data (that annoying facebook on companies collection), issue re-appear.
Just writing to let you guys know here.

@yogiHalim Can you maybe share a history of the commands you ran before, or alternatively a log file for that mongosh session (https://docs.mongodb.com/mongodb-shell/logs/)?

I tried the following command
Get-Content %UserProfile%/AppData/Local/mongodb/mongosh/_log
on the windows cmd, returns: it doesn’t recognize Get-Content
(I replaced user profile, and log filename with mine)
sorry I’m still not used to this.