Skip to main content Link Menu Expand (external link) Document Search Copy Copied

MongoDB

Connect to a server

Install mongosh first, it is a separate package.

mongosh --host 1.2.3.4

Connect to database

use db-name

Show collections (tables)

.....

Show databases

show dbs

Show users

test> use admin
switched to db admin

admin> show collections;
system.users
system.version

admin> db.system.users.find()

Show running config

db.runCommand({ getCmdLineOpts: 1 })

or

db.getCmdLineOpts()