Skip to content

getMongoData.js - Support for mongosh and MongoDB v6.X #119

@TravWill-Mongo

Description

@TravWill-Mongo

The legacy "mongo" shell is no longer available for download, and officially deprecated as of MongoDB 6.0. As the "getMongoData.js" exists today, it breaks under two known conditions:

  1. "hostname()" is no longer a supported command in mongosh. Use "os.hostname()" instead.
  2. MDB 6.0 has deprecated "db.printSlaveReplicationInfo()". Use "db.printSecondaryReplicationInfo()" instead.

I have cloned and modified the existing script to support mongosh and MDB 6.0, you can find it and the revisions here:
https://gist.github.com/TravWill-Mongo/1bb4fdbac8a4491cb2f1d76c77afba9a

For this to be properly integrated, we would need to have some conditional logic to use the right commands based upon version.

For what it's worth, I have only tested this on the following setup:

  • mongosh 1.6.1
  • mongod - 6.0.1
  • Operating System: Mac OS X 12.6.1

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions