-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: ABX
-
None
-
None
-
None
-
None
-
None
-
None
TL;DR
When a write hits a read-only bring-your-own index, the error tells the user to turn on allowWrites: true. That option is now deprecated. The error should point to the supported alternatives instead.
Context
MongoDBVector is Mastra's MongoDB vector store. With a bring-your-own (BYO) collection, Mastra searches a collection the application already owns instead of one it creates. Mastra treats these collections as read-only, so upsert(), updateVector(), deleteVector() and deleteVectors() throw a READ_ONLY_INDEX error.
This release deprecates allowWrites, which lifted that restriction. {{createIndex(
{ allowWrites: true })}} now logs a deprecation warning, and the docs tell users to write embeddings from their application or use autoEmbed (MongoDB generates the embeddings). The error message still gives the old advice.
Desired User Experience
await store.upsert({ indexName: 'precedents', vectors, metadata });
// Before: MastraError READ_ONLY_INDEX
// "... To allow writes, opt in explicitly: createIndex({ ..., allowWrites: true, ... })."
// -> recommends an option that logs a deprecation warning when used.
// After: MastraError READ_ONLY_INDEX
// "... Write embeddings into these documents from your application, or create the
// index with autoEmbed so MongoDB generates them."
// -> no mention of allowWrites.
Task
Goals: The error points users to the supported way to add embeddings, not to a deprecated option.
Where: stores/mongodb/src/vector/index.ts#L592
Acceptance Criteria
- [ ] The READ_ONLY_INDEX error recommends application-side writes or autoEmbed, and doesn't mention allowWrites.