Found by the #12252 dev while measuring the fixture census; reported rather than swept, and filed here by the domain:engine PM seat.
What ships
packages/drivers/driver-mongodb/README.md:172, inside a worked example:
company_id: {type: 'lookup',reference_to: 'company'},followed by:
// Creates: idx_id_unique, idx_name_unique, idx_email, idx_company_id_lookup
README.md is in this package's files array, so this is published to npm — user-facing instruction, not internal test data.
Two defects in one eight-line sample
1. It teaches a key the spec refuses.reference is the only relationship spelling FieldSchema declares; reference_to fails safeParse with unrecognized_keys (measured on origin/main, #12252). A reader who copies this sample writes an object that cannot be published.
2. The promised index is not produced for a correctly-authored object. Differential probe against the real syncCollectionSchema (#13222): with reference_to the index appears; with the canonical reference it does not, because mongodb-schema.ts:112-113 gates the lookup arm on reference_to. So the comment is true only of the spelling the spec rejects — for anything a user can actually author, idx_company_id_lookup is never created.
The sample is therefore self-consistent only in a state no user can reach: it teaches the wrong key, and its stated outcome depends on that wrongness.
Why it is filed separately from #13222
⚠️ This is wrong whichever way #13222 is ruled, so it must not wait on it:
Either way the published spelling must change. Only the trailing // Creates: line's fate depends on #13222.
Deliverable
Correct the sample to reference, and make the // Creates: comment state what an authored object actually gets today — i.e. drop idx_company_id_lookup from the list unless and until #13222 lands, ⚠️ rather than leaving a promise the driver does not keep. ⛔ Do not fix this by changing the driver here; that is #13222's decision.
Worth checking the other driver READMEs for the same copied sample while in there — ⛔ report anything found rather than widening this card.
Priority
Graded priority:p1 despite being "just docs": this is the material an AI author copies, it is the repo's one worked example of a MongoDB lookup, and it is already on npm. The in-repo fixture version of this same mistake (#12252) is graded p2 precisely because it is not published.
Related
#13222 (the driver defect this sample documents) · #12252 (the fixture census that surfaced it) · #12251 (closed not_planned)
Found by the #12252 dev while measuring the fixture census; reported rather than swept, and filed here by the
domain:enginePM seat.What ships
packages/drivers/driver-mongodb/README.md:172, inside a worked example:followed by:
README.mdis in this package'sfilesarray, so this is published to npm — user-facing instruction, not internal test data.Two defects in one eight-line sample
1. It teaches a key the spec refuses.
referenceis the only relationship spellingFieldSchemadeclares;reference_tofailssafeParsewithunrecognized_keys(measured onorigin/main, #12252). A reader who copies this sample writes an object that cannot be published.2. The promised index is not produced for a correctly-authored object. Differential probe against the real
syncCollectionSchema(#13222): withreference_tothe index appears; with the canonicalreferenceit does not, becausemongodb-schema.ts:112-113gates the lookup arm onreference_to. So the comment is true only of the spelling the spec rejects — for anything a user can actually author,idx_company_id_lookupis never created.The sample is therefore self-consistent only in a state no user can reach: it teaches the wrong key, and its stated outcome depends on that wrongness.
Why it is filed separately from #13222
reference_to— a key the spec REFUSES — so no authored lookup field has ever been indexed on MongoDB #13222 is fixed (the driver readsreference), the sample's spelling is wrong and its index comment becomes right;reference_to— a key the spec REFUSES — so no authored lookup field has ever been indexed on MongoDB #13222 staysnot_planned, the sample's spelling is still wrong and its index comment is also wrong for every authorable object.Either way the published spelling must change. Only the trailing
// Creates:line's fate depends on #13222.Deliverable
Correct the sample to⚠️ rather than leaving a promise the driver does not keep. ⛔ Do not fix this by changing the driver here; that is #13222's decision.
reference, and make the// Creates:comment state what an authored object actually gets today — i.e. dropidx_company_id_lookupfrom the list unless and until #13222 lands,Worth checking the other driver READMEs for the same copied sample while in there — ⛔ report anything found rather than widening this card.
Priority
Graded
priority:p1despite being "just docs": this is the material an AI author copies, it is the repo's one worked example of a MongoDB lookup, and it is already on npm. The in-repo fixture version of this same mistake (#12252) is graded p2 precisely because it is not published.Related
#13222 (the driver defect this sample documents) · #12252 (the fixture census that surfaced it) · #12251 (closed
not_planned)