Mongo shell removal in Mongo 6.0 and compatibility with older mongo shell

Hi Team,

I see the mongo legacy shell has been deprecated in Mongo 6.0 and new mongosh has been introduced. But i would like to know if the older mongo legacy shell i compatible with Mongo 6.0 . The reason for the question is, i would like to keep the older mongo shell rpm and Server alone would like to migrate that way i could avoid making changes to the scripts that are using mongo legacy shell.

Thanks,
Venkataraman

Hi @venkataraman_r ,

Thank you for reaching out.

The legacy mongo shell is deprecated starting server version 5+ so we would advise against using it. I am wondering if you have attempted to use mongosh to run your scripts as a drop-in replacement? If you have, what errors are you seeing? We’d be more than happy to work with you to get you migrated, you can feel free to reach out to me directly at gaurab.aryal@mongodb.com.

Best,
Gaurab
Sr. Product Manager, MongoDB

1 Like

Thanks Gaurab. Yes I have already tried the mongosh and its working fine.

Thanks for letting us know, @venkataraman_r. Glad it worked out!

Hi @Gaurab_Aryal ,

Apologies for activating this old thread. We see that with the new MongoShell, most of the command outputs are different when compared with the old mongoshell.

  1. the output are not in strict json format where as with the old mongo shell we get in json format. As a workaround we now have to enclose the commands with JSON.stringyfy() which seems a breaking changes in my opinion.
  2. the commands like db.printReplicationInfo and are resulting completely different output. Not sure how many more such commands output got changed.
    with old mongo 5.0 shell

set01:PRIMARY> db.printReplicationInfo()
configured oplog size: 5120MB
log length start to end: 1293671secs (359.35hrs)
oplog first event time: Tue Mar 05 2024 06:07:19 GMT+0000 (UTC)
oplog last event time: Wed Mar 20 2024 05:28:30 GMT+0000 (UTC)
now: Wed Mar 20 2024 05:28:36 GMT+0000 (UTC)
set01:PRIMARY>

with the new mongoShell

set01 [direct: primary] session_cache> db.printReplicationInfo()
actual oplog size
'5120 MB'
---
configured oplog size
'5120 MB'
---
log length start to end
'1293631 secs (359.34 hrs)'
---
oplog first event time
'Tue Mar 05 2024 06:07:19 GMT+0000 (Coordinated Universal Time)'
---
oplog last event time
'Wed Mar 20 2024 05:27:50 GMT+0000 (Coordinated Universal Time)'
---
now
'Wed Mar 20 2024 05:27:49 GMT+0000 (Coordinated Universal Time)'
set01 [direct: primary] session_cache>

Our scripts are tightly coupled with the response content from mongo. Since the output format is changed we are having trouble in many scripts. while the long term solution would be rewrite the code with the expectation from the new mongoshell, We would like to know what would be the potential issues using mongo old shell (lets say 5.5 mongoshell) with the mongo server version 6.0. We just get the deprecated warning but everything works as usual. But we would like to get your opinion on this.

Team,

Can someone please provide your response on this?