How to list all databases in the mongo shell?

前端 未结 7 1866
灰色年华
灰色年华 2021-01-29 19:23

I know how to list all collections in a particular database, but how do I list all available databases in MongoDB shell?

7条回答
  •  情书的邮戳
    2021-01-29 20:26

    Couple of commands are there to list all dbs in MongoDB shell.

    first , launch Mongodb shell using 'mongo' command.

    mongo

    Then use any of the below commands to list all the DBs.

    • show dbs
    • show databases
    • db.adminCommand( { listDatabases: 1 , nameOnly : true} )

    For more details please check here

    Thank you.

提交回复
热议问题