Agent Skillsopskat/opskat › mongodb

mongodb

GitHub

提供 MongoDB 集合的查询与修改能力,支持 find、insert、update、delete 及聚合等操作。通过 exec 执行命令,使用 JSON 语法传递查询参数,适用于数据检索、写入、更新及批量处理场景。

internal/ai/skills/mongodb/SKILL.md opskat/opskat

Trigger Scenarios

需要查询 MongoDB 数据 需要向 MongoDB 插入或更新文档 需要从 MongoDB 删除数据 需要对 MongoDB 数据进行聚合分析

Install

npx skills add opskat/opskat --skill mongodb -g -y
More Options

Non-standard path

npx skills add https://github.com/opskat/opskat/tree/main/internal/ai/skills/mongodb -g -y

Use without installing

npx skills use opskat/opskat@mongodb

指定 Agent (Claude Code)

npx skills add opskat/opskat --skill mongodb -a claude-code -g -y

安装 repo 全部 skill

npx skills add opskat/opskat --all -g -y

预览 repo 内 skill

npx skills add opskat/opskat --list

SKILL.md

Frontmatter
{
    "name": "mongodb",
    "description": "Query and modify MongoDB collections via exec, using an operation + collection + JSON query syntax."
}

MongoDB assets

Command syntax

<operation> [collection] [--db=<database>] [--query=<json>]

  • find users --query='{"filter":{"age":{"$gt":21}},"limit":10}'
  • findOne users --query='{"filter":{"_id":"abc"}}'
  • aggregate events --query='{"pipeline":[{"$match":{"type":"click"}}]}'
  • countDocuments users
  • insertOne users --query='{"document":{"name":"alice"}}'
  • updateMany users --query='{"filter":{"active":false},"update":{"$set":{"archived":true}}}'
  • deleteMany logs --query='{"filter":{"level":"debug"}}'
  • listDatabases
  • listCollections --db=analytics

Supported operations: find, findOne, insertOne, insertMany, updateOne, updateMany, deleteOne, deleteMany, aggregate, countDocuments, listDatabases, listCollections. Anything else is rejected.

Query sub-keys

--query is a single JSON object. Which sub-keys apply depends on the operation:

  • find: filter, sort, projection, limit, skip
  • findOne: filter, projection (sort / limit / skip are silently ignored)
  • insertOne: document · insertMany: documents
  • updateOne / updateMany: filter, update
  • deleteOne / deleteMany: filter
  • aggregate: pipeline
  • countDocuments: filter

Notes

  • Always single-quote --query — it is JSON and contains spaces and braces.
  • find returns at most 100 documents when limit is omitted. Pass an explicit limit when you need to know you have the whole result set.
  • Every operation except listDatabases needs a database. --db names it; if you omit --db, the asset's configured default database is used. When the asset has no default database configured, omitting --db fails — pass it explicitly.
  • listDatabases and listCollections take no collection; every other operation requires one.
  • Omitting --query means "no filter": deleteMany logs deletes every document in the collection, and updateMany without an update sub-key fails. Pass an explicit filter whenever you mean a subset.
  • Quote a collection name containing spaces (countDocuments 'my coll'). A collection name starting with -- cannot be expressed — it is read as a flag.
  • The command line is shell-tokenized but not shell-executed: $, |, >, & and similar shell metacharacters produce an error rather than expanding or redirecting. Wrap values containing them in single quotes.
  • Unknown flags are rejected rather than ignored; only --db and --query exist.
  • The scope parameter is not used by MongoDB assets; use --db instead.

Asset config (for put_asset)

field type required notes
host string yes
port number yes No server-side default — pass 27017 explicitly
username string yes
password string no Stored encrypted; never echoed back
database string no Default database
ssh_asset_id number no SSH asset to tunnel through; 0 detaches

Auth source is fixed to admin; it is not configurable through put_asset.

Version History

  • d6c7a6e Current 2026-08-16 07:29

    修正 findOne 仅支持 filter/projection 及 find 省略 limit 时封顶 100 条的事实性错误。

  • aeb4bc3 2026-07-24 16:28

Same Skill Collection

internal/ai/skills/database/SKILL.md
internal/ai/skills/etcd/SKILL.md
internal/ai/skills/k8s/SKILL.md
internal/ai/skills/kafka/SKILL.md
internal/ai/skills/local/SKILL.md
internal/ai/skills/oss/SKILL.md
internal/ai/skills/rdp/SKILL.md
internal/ai/skills/redis/SKILL.md
internal/ai/skills/serial/SKILL.md
internal/ai/skills/ssh/SKILL.md
internal/ai/skills/vnc/SKILL.md
plugin/opsctl/skills/opsctl/SKILL.md

Metadata

Files
0
Version
d6c7a6e
Hash
e7f2463a
Indexed
2026-07-24 16:28

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-18 05:03
浙ICP备14020137号-1 $mapa de visitantes$