Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers MongoDB schema design patterns and anti-patterns, including embed-vs-reference decisions, unbounded arrays, and schema validation.
70% 87%+17 ptsof test cases passed
Passed 20 of 23 test cases with the skill, and 16 of 23 without it.
3 of 3 safety checks passed
16 agent runs
If documents have many optional fields, move them into a key-value array. This avoids dozens of sparse indexes and lets you query across attributes with a single multikey index.
Incorrect (separate field and index per optional attribute):
// Many optional fields - most are missing on any given document
{
_id: 1,
name: "Bottle",
color: "red",
size: "M",
material: "glass",
// 20+ other optional fields, varying per document
}
// One partial index per optional field — correct use of partialFilterExpression,
// but you end up maintaining dozens of indexes as attributes grow
db.items.createIndex({ color: 1 }, { partialFilterExpression: { color: { $exists: true } } })
db.items.createIndex({ size: 1 }, { partialFilterExpression: { size: { $exists: true } } })
db.items.createIndex({ material: 1 }, { partialFilterExpression: { material: { $exists: true } } })
// … repeated for every new attribute
Correct (attribute pattern):
// Store optional fields as key-value pairs
{
_id: 1,
name: "Bottle",
attributes: [
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.