# Mongodb

> Manage MongoDB databases via the mongosh CLI. Use when querying, inspecting, or managing MongoDB collections.

- Skill: `fworks-tech/mongodb` (Agent Skill)
- Install (CLI): `npx skillmds@latest add fworks-tech/mongodb`
- Raw SKILL.md: https://api.skillmd.com/api/skills/fworks-tech/mongodb/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: fworks-tech (https://skillmd.com/u/fworks-tech)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/fworks-tech/mongodb

---


# mongosh

Use `mongosh` to interact with MongoDB databases.

## Common Commands

### Connection
- Connect: `mongosh "mongodb://localhost:27017"`
- Connect with auth: `mongosh "mongodb://user:pass@host:27017/db"`

### Inspection
- List databases: `show dbs`
- Use database: `use <dbname>`
- List collections: `show collections`

### Queries
- Find documents: `db.collection.find({ field: "value" }).limit(10)`
- Count documents: `db.collection.countDocuments({})`
- Insert: `db.collection.insertOne({ name: "test" })`
- Update: `db.collection.updateOne({ _id: id }, { $set: { field: "value" } })`

## Notes
- Use `mongosh` (new shell) not the deprecated `mongo` shell
- Connection string format: `mongodb://[user:pass@]host[:port]/[db]`

