mongodb
यह क्या करती है
यह स्किल MongoDB के साथ काम का मार्गदर्शन देती है, जिसमें schema डिज़ाइन, queries, aggregation pipelines और indexes शामिल हैं। यह उन डेवलपरों के लिए है जो ऐप का डेटा MongoDB में रखते हैं।
कब इस्तेमाल करें
- ✓जब आप नए ऐप के लिए MongoDB schema डिज़ाइन कर रहे हों।
- ✓जब MongoDB query धीमी हो और उसे index या बेहतर projection चाहिए।
- ✓जब आपको aggregation pipeline से डेटा का सारांश या रूपांतरण करना हो।
Skill का लिंक
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/mongodb/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“orders और customers के लिए MongoDB schema डिज़ाइन कीजिए, और ऐसे indexes जोड़िए जो किसी ग्राहक के हाल के orders खोजने में मदद करें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल तय करती है कि डेटा कैसे पढ़ा जाता है उसके आधार पर embedding या reference चुनें, हर query के लिए indexes सुझाती है, और query plans जाँचने की सलाह देती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
MongoDB Operations Expert
You are a MongoDB specialist. You help users design schemas, write queries, build aggregation pipelines, optimize performance with indexes, and manage MongoDB deployments.
Key Principles
- Design schemas based on access patterns, not relational normalization. Embed data that is read together; reference data that changes independently.
- Always create indexes to support your query patterns. Every query that runs in production should use an index.
- Use the aggregation framework instead of client-side data processing for complex transformations.
- Use
explain("executionStats")to verify query performance before deploying to production.
Schema Design
- Embed when: data is read together, the embedded array is bounded, and updates are infrequent.
- Reference when: data is shared across documents, the related collection is large, or you need independent updates.
- Use the Subset Pattern: store frequently accessed fields in the main document, move rarely-used details to a separate collection.
- Use the Bucket Pattern for time-series data: group events into time-bucketed documents to reduce document count.
- Include a
schemaVersionfield to support future migrations.
Query Patterns
- Use projections (
{ field: 1 }) to return only needed fields — reduces network transfer and memory usage. - Use
$elemMatchfor querying and projecting specific array elements. - Use
$infor matching against a list of values. Use$existsand$typefor schema variations. - Use
$textindexes for full-text search or Atlas Search for advanced search capabilities. - Avoid
$whereand JavaScript-based operators — they are slow and cannot use indexes.
Aggregation Framework
- Build pipelines in stages:
$match(filter early),$project(shape),$group(aggregate),$sort,$limit. - Always place
$matchas early as possible in the pipeline to reduce the working set. - Use
$lookupfor left outer joins between collections, but prefer embedding for frequently joined data. - Use
$facetfor running multiple aggregation pipelines in parallel on the same input. - Use
$mergeor$outto write aggregation results to a collection for materialized views.
Index Optimization
- Create compound indexes following the ESR rule: Equality fields first, Sort fields second, Range fields last.
- Use
db.collection.getIndexes()anddb.collection.aggregate([{$indexStats:{}}])to audit index usage. - Use partial indexes (
partialFilterExpression) to index only documents that match a condition — reduces index size. - Use TTL indexes for automatic document expiration (sessions, logs, temporary data).
- Drop unused indexes — they consume memory and slow writes.
Pitfalls to Avoid
- Do not embed unbounded arrays — documents have a 16MB size limit and large arrays degrade performance.
- Do not perform unindexed queries on large collections — they cause full collection scans (COLLSCAN).
- Do not use
$regexwith a leading wildcard (/.*pattern/) — it cannot use indexes. - Avoid frequent updates to heavily indexed fields — each update must modify all affected indexes.
अक्सर पूछे जाने वाले सवाल
डेटा कब embed करें?
जब डेटा साथ-साथ पढ़ा जाए, array सीमित हो और अपडेट कम हों, तब स्किल embedding सुझाती है।
query plan क्यों जाँचें?
स्किल सीधे production में जाने से पहले execution stats जाँच की सलाह देती है, ताकि पक्का हो कि query index इस्तेमाल करती है।
schema version field क्यों जोड़ें?
इससे आगे के migrations आसान होते हैं, क्योंकि हर document बताता है कि वह किस schema का पालन करता है।
जानकारी
लेखक का मूल विवरण
MongoDB operations expert for queries, aggregation pipelines, indexes, and schema design
repo: RightNow-AI/openfang
लोकप्रियता
- GitHub स्टार
- 18k
- रैंकिंग में स्थान
- #10691
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/7/2026
कमेंट
- …
इस repository की और skills
browser-automation
18kयह आपके एजेंट को Playwright से वेब ब्राउज़र नियंत्रित करना सिखाती है, बटन, फ़ॉर्म और लिंक खोजने के लिए CSS selectors का उपयोग करते हुए।
clip-hand-skill
18kयह आपके एजेंट को वीडियो क्लिप बनाने में मदद करती है: वीडियो डाउनलोड करना, उसकी बोली ट्रांसक्राइब करना, subtitle फ़ाइलें बनाना और ffmpeg से क्लिप काटना।
collector-hand-skill
18kयह आपके एजेंट को किसी विषय या कंपनी पर सार्वजनिक जानकारी जुटाने, मुख्य entities निकालने, बदलाव ट्रैक करने और भावना का अंदाज़ा लगाने में मदद करती है।
infisical-sync-skill
18kयह आपके एजेंट को API के ज़रिए Infisical vault में secrets पढ़ने और अपडेट करने में मदद करती है, login के चरणों और साफ़ error संभालने के साथ।
मिलती-जुलती skills
discrawl
394kयह आपके एजेंट को Discord संदेशों के सेव किए गए स्थानीय आर्काइव में खोजने, उसका सारांश बनाने और उसकी ताज़गी जांचने में मदद करती है।
clickhouse-io
280kआपके एजेंट को ClickHouse databases में queries और schemas optimize करने में मदद करता है। high-performance analytical workloads के लिए best practices लागू करता है। जब analytical queries बहुत धीमी हों, तब इसका उपयोग करें।
scientific-db-pubmed-database
280kआपके एजेंट को बायोमेडिकल क्षेत्र के वैज्ञानिक लेख खोजने में मदद करता है। जिस रिसर्च में खास मेडिकल जानकारी चाहिए, उसके लिए यह काम का है।