Mongosh performance


mongosh client is taking about 10 times longer than previous mongo client when using --eval to query the DB.

For instance, the following mongosh comand is taking around 2.26 seconds in one of our environments and only 0.16 seconds if we use mongo instead of mongosh

$ time mongosh --eval 'db.adminCommand({ping: 1})'
Current Mongosh Log ID:	62a21572cfd011d5ac021e05
Connecting to:		mongodb://
Using MongoDB:		5.0.9
Using Mongosh:		1.5.0

For mongosh info see:

  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1654789485, i: 1 }),
    signature: {
      hash: Binary(Buffer.from("a32d1165b14260c59870e293075b7d56d9ee9fbf", "hex"), 0),
      keyId: Long("7107233936354312197")
  operationTime: Timestamp({ t: 1654789485, i: 1 })

real	0m2.403s
user	0m1.334s
sys	0m0.178s

The tests were executed with the following configuration:

  enableTelemetry: false
  snippetAutoload: false

Is there any way to improve the performance of mongosh?

You might do best filing an issue on mongosh to get developer attention.

Thanks @Jack_Woehr for your quick response.

It seems the issue is there, MONGOSH-1240, since 2 week ago.

1 Like

@Fran_Mulero that just proves that your are in the vanguard!