Mongodb

Manage MongoDB databases via the mongosh tool.

olasunkanmi-se e503911 557 B Updated

File contents

mongosh

Use mongosh to interact with MongoDB databases.

Common Commands

Connection

  • Connect: mongosh "mongodb://user:password@host:port/dbname"

Operations

  • Show databases: show dbs
  • Use database: use <dbname>
  • Show collections: show collections
  • Find documents: db.collection.find().limit(5)
  • Insert document: db.collection.insertOne({ key: "value" })
  • Quit: exit

Notes

  • Requires mongosh to be installed in the environment.

olasunkanmi-se/codebuddy/tree/main/skills/mongodb commit e503911368

Frequently asked questions

npx skillmds@latest add olasunkanmi-se/mongodb