MongoDB Data Practices
Application skill for jsoendermann MongoStyleGuide + MongoDB official data-modeling ingest (awesome-guidelines). Application-layer JS/Node: also node-coding-practices / javascript-coding-practices.
Core Principle
Mongo schema quality is self-documenting BSON aligned to read patterns, explicit enum states, consistent null semantics, camelCase keys, and embed/reference choices driven by access patterns not premature scale fantasies.
When to Use / NOT
- Designing new collections, migrations,
$jsonSchema validators.
- Reviewing BSON documents, seed data, aggregation inputs.
- Choosing embed vs reference for related entities.
NOT when:
- SQL relational schemas,
sql-scripting-practices.
- MongoDB server C++ contributions, upstream server styleguides.
- Generic API JSON without Mongo persistence,
json-api-practices.
Workflow
- Enums/booleans, UPPERCASE strings, prefixes, merge flags (
mongo-style-enums-booleans.md).
- Dates/null/types, Date vs day string, homogeneous columns (
mongo-style-dates-null-types.md).
- Names/IDs, camelCase, collections, string
_id (mongo-style-names-ids.md).
- Modeling, nesting, embed/reference, validation, indexes (
mongo-style-modelling-verify.md).
- Verify,
$jsonSchema, index explain, sample doc audit.
Red Flags
- Numeric or boolean enum codes
null / missing as enum "unknown"
- Title-case enum mixed with UPPERCASE constants
- Mutually exclusive boolean triplets
- ISO date strings persisted instead of BSON Date
- Date type for birthdate-only fields
- Business meaning overloaded onto null/undefined
- null and missing mixed in same field path
null instead of '' or [] defaults
- Mixed BSON types in one field
- Heterogeneous object shapes in array columns
0 or '' as "unknown" sentinel
- Numeric strings for arithmetic fields
- ObjectId
_id with app serialization bugs
- snake_case field keys in JS-first apps
- Unbounded embedded arrays without reference split
- Deep nesting without subdocument justification
- Transactions compensating for bad embed choice
- Hot queries without supporting indexes
- Abbreviated field names outside domain DSL
Verification
$jsonSchema or validator on changed collections
$type / sample audit on enum and date fields
- Embed/reference checklist vs MongoDB official table
explain() on primary read paths; index list matches filters/sorts
- Capsule probes cited in review notes
References
awesome-guidelines/references/mongo-style-learning-note.md
awesome-guidelines/references/mongo-style-enums-booleans.md
awesome-guidelines/references/mongo-style-dates-null-types.md
awesome-guidelines/references/mongo-style-names-ids.md
awesome-guidelines/references/mongo-style-modelling-verify.md
Related skills
node-coding-practices, Node app code reading/writing documents
javascript-coding-practices, app-layer validation and types
sql-scripting-practices, when data lives in SQL instead
1---2name: mongodb-data-practices3description: Use when designing or reviewing MongoDB schemas, UPPERCASE enums, is/has booleans, BSON dates, null semantics, camelCase keys, string _id, embed vs reference, validation, and indexes.4---56# MongoDB Data Practices78Application skill for jsoendermann MongoStyleGuide + MongoDB official data-modeling ingest (`awesome-guidelines`). Application-layer JS/Node: also `node-coding-practices` / `javascript-coding-practices`.910## Core Principle1112Mongo schema quality is **self-documenting BSON aligned to read patterns**, explicit enum states, consistent null semantics, camelCase keys, and embed/reference choices driven by access patterns not premature scale fantasies.1314## When to Use / NOT1516- Designing new collections, migrations, `$jsonSchema` validators.17- Reviewing BSON documents, seed data, aggregation inputs.18- Choosing embed vs reference for related entities.1920**NOT when:**2122- SQL relational schemas, `sql-scripting-practices`.23- MongoDB server C++ contributions, upstream server styleguides.24- Generic API JSON without Mongo persistence, `json-api-practices`.2526## Workflow27281. **Enums/booleans**, UPPERCASE strings, prefixes, merge flags (`mongo-style-enums-booleans.md`).292. **Dates/null/types**, Date vs day string, homogeneous columns (`mongo-style-dates-null-types.md`).303. **Names/IDs**, camelCase, collections, string `_id` (`mongo-style-names-ids.md`).314. **Modeling**, nesting, embed/reference, validation, indexes (`mongo-style-modelling-verify.md`).325. **Verify**, `$jsonSchema`, index explain, sample doc audit.3334## Red Flags3536- Numeric or boolean enum codes37- `null` / missing as enum "unknown"38- Title-case enum mixed with UPPERCASE constants39- Mutually exclusive boolean triplets40- ISO date strings persisted instead of BSON Date41- Date type for birthdate-only fields42- Business meaning overloaded onto null/undefined43- null and missing mixed in same field path44- `null` instead of `''` or `[]` defaults45- Mixed BSON types in one field46- Heterogeneous object shapes in array columns47- `0` or `''` as "unknown" sentinel48- Numeric strings for arithmetic fields49- ObjectId `_id` with app serialization bugs50- snake_case field keys in JS-first apps51- Unbounded embedded arrays without reference split52- Deep nesting without subdocument justification53- Transactions compensating for bad embed choice54- Hot queries without supporting indexes55- Abbreviated field names outside domain DSL5657## Verification5859- `$jsonSchema` or validator on changed collections60- `$type` / sample audit on enum and date fields61- Embed/reference checklist vs MongoDB official table62- `explain()` on primary read paths; index list matches filters/sorts63- Capsule probes cited in review notes646566## References6768- `awesome-guidelines/references/mongo-style-learning-note.md`69- `awesome-guidelines/references/mongo-style-enums-booleans.md`70- `awesome-guidelines/references/mongo-style-dates-null-types.md`71- `awesome-guidelines/references/mongo-style-names-ids.md`72- `awesome-guidelines/references/mongo-style-modelling-verify.md`7374## Related skills7576- `node-coding-practices`, Node app code reading/writing documents77- `javascript-coding-practices`, app-layer validation and types78- `sql-scripting-practices`, when data lives in SQL instead