Agent Skills: Simple read

Use for managing MongoDB (a DB already connected)

UncategorizedID: rakibdev/dotfiles/mongodb

Install this agent skill to your local

pnpm dlx add-skill https://github.com/rakibdev/dotfiles/tree/HEAD/home/.config/opencode/skill/mongodb

Skill Files

Browse the full folder contents for mongodb.

Download Skill

Loading file tree…

home/.config/opencode/skill/mongodb/SKILL.md

Skill Metadata

Name
mongodb
Description
Use for managing MongoDB (a DB already connected)

Usage

bun scripts/query.ts "<query>"

Examples

# Simple read
bun scripts/query.ts "db.collection('users').findOne()"

# Query with ObjectId
bun scripts/query.ts "db.collection('users').findOne({ _id: new ObjectId('...') })"

# Multi-step update (Batching)
bun scripts/query.ts "Promise.all([
  db.collection('rewards').deleteMany({ userId: new ObjectId('...') }),
  db.collection('users').updateOne({ _id: new ObjectId('...') }, { \$set: { 'dailyXp.count': 0 } })
])"

Tips

  • Use query.ts over writing one-off scripts. Use Promise.all for parallel operations or an IIFE (async () => { ... })() for complex multi-step logic.
  • ObjectId is globally available in the query context.
  • Use limit(1) or findOne() to understand schema without wasting tokens.
  • Use countDocuments() instead of fetching docs for existence checks.