mongodb

mongodb is a skill for Claude Code, Codex from chaterm/terminal-skills. It costs 7 tokens per session (1,765 once invoked), scanned A, original, Apache-2.0.

A guide for managing MongoDB, a database that stores records in flexible document collections. It covers local, remote, and replica-set connections, database and collection administration, data operations, and indexes.

In plain words
What is it for?
Use it to connect with `mongosh`, run scripts, create or remove databases and collections, insert, query, update, or delete records, inspect statistics, and manage indexes.
Why use it?
It gives developers ready command examples for common MongoDB administration and data tasks instead of requiring them to remember the shell syntax.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to connect with mongosh, run scripts, create or remove databases and collections, insert, query, update, or delete records, inspect statistics, and manage indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chaterm/terminal-skills/mongodb
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chaterm/terminal-skills --skill mongodb
Clone the repo
git clone --depth 1 https://github.com/chaterm/terminal-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mongodb

README.md
[![agentmods](https://agentmods.dev/badge/skills/chaterm/terminal-skills/mongodb/github.svg)](https://agentmods.dev/skills/chaterm/terminal-skills/mongodb)
Your own site
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/mongodb"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/mongodb/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mongodb

Your own site · 80×15
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/mongodb"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/mongodb.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,765 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00007 $0.01765
Opus 5 $0.00003 $0.00882
Sonnet 5 $0.00001 $0.00353
Haiku 4.5 $0.00001 $0.00177

Measured 10d ago against content hash fc95bb53d5e6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

mongodb scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

database/mongodb/SKILL.md · 275 lines

How it starts

The opening of the file, as written. The whole thing — 275 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MongoDB 数据库管理

概述

MongoDB 操作、索引优化、分片集群等技能。

连接管理

# 本地连接
mongosh
mongosh --port 27017

# 远程连接
mongosh "mongodb://hostname:27017"
mongosh "mongodb://user:password@hostname:27017/database"

# 副本集连接
mongosh "mongodb://host1:27017,host2:27017,host3:27017/database?replicaSet=rs0"

# 执行脚本
mongosh script.js
mongosh --eval "db.collection.find()"

基础操作

数据库操作

// 显示数据库
show dbs

// 切换/创建数据库
use mydb

// 删除数据库
db.dropDatabase()

// 数据库统计
db.stats()

集合操作

// 显示集合
show collections

// 创建集合
db.createCollection("users")

// 删除集合
db.users.drop()

// 集合统计
db.users.stats()

CRUD 操作

// 插入
db.users.insertOne({ name: "John", age: 30 })
db.users.insertMany([{ name: "Jane" }, { name: "Bob" }])

// 查询
db.users.find()
db.users.find({ age: { $gt: 25 } })
db.users.findOne({ name: "John" })
db.users.find().limit(10).skip(20).sort({ age: -1 })

// 更新
db.users.updateOne({ name: "John" }, { $set: { age: 31 } })
db.users.updateMany({ age: { $lt: 18 } }, { $set: { status: "minor" } })
db.users.replaceOne({ name: "John" }, { name: "John", age: 32 })

// 删除
db.users.deleteOne({ name: "John" })
db.users.deleteMany({ status: "inactive" })

索引管理

// 查看索引
db.users.getIndexes()

// 创建索引
db.users.createIndex({ email: 1 })                    // 升序
db.users.createIndex({ name: 1, age: -1 })            // 复合索引
db.users.createIndex({ email: 1 }, { unique: true })  // 唯一索引
db.users.createIndex({ location: "2dsphere" })        // 地理索引
db.users.createIndex({ content: "text" })             // 文本索引

// 后台创建(不阻塞)
db.users.createIndex({ field: 1 }, { background: true })

// 删除索引
db.users.dropIndex("email_1")
db.users.dropIndexes()                                // 删除所有

// 索引使用分析
db.users.find({ email: "[email protected]" }).explain("executionStats")

聚合操作

// 基础聚合
db.orders.aggregate([
    { $match: { status: "completed" } },
    { $group: { _id: "$customer", total: { $sum: "$amount" } } },
    { $sort: { total: -1 } },
    { $limit: 10 }
])

// 常用聚合操作符
// $match - 过滤
// $group - 分组
// $sort - 排序
// $limit - 限制
// $skip - 跳过
// $project - 投影
// $unwind - 展开数组
// $lookup - 关联查询

// 关联查询
db.orders.aggregate([
    {
        $lookup: {
            from: "users",
            localField: "userId",
            foreignField: "_id",
            as: "user"
        }
    }
])

Read the full file on GitHub · 275 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 275 lines · 7 tokens per session scan A fc95bb53d5e6

Subscribe to this mod's changes

mongodb is a skill published in the GitHub repository chaterm/terminal-skills (58 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 7 tokens to every session and 1,765 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

mongodb

Use when modeling MongoDB documents (embed versus reference, the 16MB cap, bucket and subset patterns), choosing or fixing indexes (compound order by the ESR rule, partial, TTL, multikey, reading explain), writing aggregation pipelines that stay index-eligible, running multi-document transactions with retry, or…

ericrisco/rsc-harness · 118 tokens

mongodb-expert

Expert-level MongoDB database design, aggregation pipelines, indexing, replication, and production operations. Use when the user mentions NoSQL, database, aggregation, or performance, or when the task involves CRUD Operations, Query Operators, Aggregation Pipeline, or Indexing.

personamanagmentlayer/pcl · 56 tokens

database-migrator

Migrates databases between providers (Postgres, MySQL, Supabase, PlanetScale, MongoDB). Reads source schema, generates migration scripts, handles data type mapping, foreign keys, indexes, triggers, stored procedures. Validates migration with row counts and checksums. Generates migration-plan.md with step-by-step…

OneWave-AI/claude-skills · 76 tokens

database-schema-designer

Design optimized database schemas for SQL and NoSQL databases including tables, relationships, indexes, and constraints. Creates ERD diagrams, migration scripts, and data modeling best practices. Use when users need database design, schema optimization, or data architecture planning.

OneWave-AI/claude-skills · 54 tokens

mongodb

MongoDB - NoSQL document database with flexible schema design, aggregation pipelines, indexing strategies, and Spring Data integration.

bobmatnyc/claude-mpm-skills · 24 tokens

nosql-database-design

Designs a NoSQL data model by leading with access pattern analysis. Covers DynamoDB single-table design (PK/SK/GSI) and MongoDB embedding vs referencing, consistency models, and capacity planning. Invoked when the user asks to design a DynamoDB schema, MongoDB data model, or NoSQL data model.

soulcodex/agentic · 71 tokens