@mastra/mongodb 1.18.4 → 1.18.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/docs/SKILL.md +9 -9
  2. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  3. package/dist/docs/references/docs-memory-semantic-recall.md +0 -2
  4. package/dist/docs/references/docs-memory-working-memory.md +1 -1
  5. package/dist/docs/references/reference-rag-vector-databases.md +33 -33
  6. package/dist/docs/references/reference-storage-composite.md +1 -1
  7. package/dist/docs/references/reference-vectors-mongodb.md +2 -2
  8. package/dist/index.cjs +4 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.js +4 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/storage/connectors/MongoDBConnector.d.ts.map +1 -1
  13. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  14. package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
  15. package/dist/storage/domains/blobs/index.d.ts.map +1 -1
  16. package/dist/storage/domains/datasets/index.d.ts.map +1 -1
  17. package/dist/storage/domains/experiments/index.d.ts.map +1 -1
  18. package/dist/storage/domains/knowledge/index.d.ts.map +1 -1
  19. package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
  20. package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -1
  21. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  22. package/dist/storage/domains/notifications/index.d.ts.map +1 -1
  23. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  24. package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
  25. package/dist/storage/domains/schedules/index.d.ts.map +1 -1
  26. package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
  27. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  28. package/dist/storage/domains/skills/index.d.ts.map +1 -1
  29. package/dist/storage/domains/utils.d.ts.map +1 -1
  30. package/dist/storage/domains/workflow-definitions/index.d.ts.map +1 -1
  31. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  32. package/dist/storage/domains/workspaces/index.d.ts.map +1 -1
  33. package/dist/storage/index.d.ts.map +1 -1
  34. package/dist/vector/filter.d.ts.map +1 -1
  35. package/dist/vector/index.d.ts.map +1 -1
  36. package/package.json +5 -6
  37. package/CHANGELOG.md +0 -5810
@@ -3,7 +3,7 @@ name: mastra-mongodb
3
3
  description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mongodb"
6
- version: "1.18.4"
6
+ version: "1.18.5-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -16,20 +16,20 @@ Read the individual reference documents for detailed explanations and code examp
16
16
 
17
17
  ### Docs
18
18
 
19
- - [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
20
- - [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
21
- - [Storage](references/docs-storage.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
19
+ - [Semantic recall](references/docs-memory-semantic-recall.md) - Retrieve relevant messages from past Mastra conversations with semantic recall, vector search, embeddings, metadata filters, and configurable storage.
20
+ - [Working memory](references/docs-memory-working-memory.md) - Persist user profiles, preferences, and application data with Mastra working memory using resource- or thread-scoped templates and storage adapters.
21
+ - [Storage](references/docs-storage.md) - Configure Mastra storage to persist memory, workflow state, observability data, evals, schedules, and long-running agent state across restarts.
22
22
 
23
23
  ### Integrations
24
24
 
25
- - [MongoDB](references/integrations-databases-mongodb.md) - Documentation for the MongoDB storage implementation in Mastra.
25
+ - [MongoDB](references/integrations-databases-mongodb.md) - Store Mastra application data and vectors in MongoDB, configure connections and collections, initialize schemas, and add persistent agent memory.
26
26
 
27
27
  ### Reference
28
28
 
29
- - [Retrieval, semantic search, reranking](references/reference-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
30
- - [Storing embeddings in a vector database](references/reference-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
31
- - [Reference: Composite storage](references/reference-storage-composite.md) - Documentation for combining multiple storage backends in Mastra.
32
- - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - Documentation for the MongoDBVector class in Mastra, which provides vector search using MongoDB Atlas and Vector Search.
29
+ - [Retrieval, semantic search, reranking](references/reference-rag-retrieval.md) - After storing embeddings, you need to retrieve relevant chunks to answer user queries.
30
+ - [Storing embeddings in a vector database](references/reference-rag-vector-databases.md) - After generating embeddings, you need to store them in a database that supports vector similarity search.
31
+ - [Reference: Composite storage](references/reference-storage-composite.md) - MastraCompositeStore can compose storage domains from different providers. Use it when you need different databases for different purposes.
32
+ - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - The MongoDBVector class provides vector search using MongoDB Vector Search. It enables efficient similarity search and metadata filtering within your MongoDB collections.
33
33
 
34
34
 
35
35
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.18.4",
2
+ "version": "1.18.5-alpha.1",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -14,8 +14,6 @@ Semantic recall is RAG-based search that helps agents maintain context across lo
14
14
 
15
15
  It uses vector embeddings of messages for similarity search and integrates with vector stores, plus has configurable context windows around retrieved messages.
16
16
 
17
- ![Diagram showing Mastra Memory semantic recall](/assets/images/semantic-recall-fd7b9336a6d0d18019216cb6d3dbe710.png)
18
-
19
17
  When it's enabled, new messages are used to query a vector DB for semantically similar messages.
20
18
 
21
19
  After getting a response from the LLM, all new messages (user, assistant, and tool calls/results) are inserted into the vector DB to be recalled in later interactions.
@@ -275,7 +275,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
275
275
  ## Choosing between template and schema
276
276
 
277
277
  - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics**: the agent must provide the complete memory content on each update.
278
- - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics**: the agent only provides fields to update, and existing fields are preserved.
278
+ - Use a **schema** for structured, type-safe JSON data that supports validation and programmatic access. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema, such as Zod v3 or v4. JSON Schema and already-standard schemas are also supported. **Merge semantics** preserve existing fields when the agent provides only the fields to update.
279
279
  - Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
280
280
 
281
281
  ## Example: Multi-step retention
@@ -35,11 +35,11 @@ MongoDB Vector Search is a good solution for teams who want to consolidate vecto
35
35
 
36
36
  ### Using VoyageAI with MongoDB
37
37
 
38
- MongoDB works seamlessly with VoyageAI's embedding models, which are optimized for retrieval tasks. For complete examples and specialized models, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings) and [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb).
38
+ MongoDB works directly with VoyageAI's embedding models, which are optimized for retrieval tasks. For complete examples and specialized models, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings) and [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb).
39
39
 
40
40
  ### Hybrid Search (Vector + Full-Text)
41
41
 
42
- MongoDB supports hybrid search that fuses vector similarity with BM25 full-text search using server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and enabled on MongoDB Atlas 8.0.x). This is useful when you want to combine semantic and keyword-based retrieval:
42
+ MongoDB supports hybrid search that combines vector similarity with BM25 full-text search through server-side `$rankFusion`. It requires MongoDB 8.0 or later, is generally available from 8.1, and is enabled on MongoDB Atlas 8.0.x. Use it to combine semantic retrieval with keyword-based results:
43
43
 
44
44
  ```ts
45
45
  await store.createSearchIndex({ indexName: 'myCollection', fields: ['text'] })
@@ -107,7 +107,7 @@ await store.upsert({
107
107
 
108
108
  ### Using Oracle Database Vector Search
109
109
 
110
- OracleDB stores embeddings in native `VECTOR` columns and metadata in Oracle JSON. Exact search is the default; HNSW and IVF indexes can be configured for tuned deployments.
110
+ OracleDB stores embeddings in native `VECTOR` columns and metadata in Oracle JSON. Exact search is the default. HNSW and IVF indexes can be configured for tuned deployments.
111
111
 
112
112
  **Pinecone**:
113
113
 
@@ -239,8 +239,8 @@ const store = new UpstashVector({
239
239
  token: process.env.UPSTASH_TOKEN,
240
240
  })
241
241
 
242
- // There is no store.createIndex call here, Upstash creates indexes (known as namespaces in Upstash) automatically
243
- // when you upsert if that namespace does not exist yet.
242
+ // Upstash creates indexes (known as namespaces) automatically, so no store.createIndex call is needed here
243
+ // when you upsert if that namespace doesn't exist yet.
244
244
  await store.upsert({
245
245
  indexName: 'myCollection', // the namespace name in Upstash
246
246
  vectors: embeddings,
@@ -426,20 +426,20 @@ Collection and index names must:
426
426
 
427
427
  - Start with a letter or underscore
428
428
  - Be up to 120 bytes long
429
- - Contain only letters, numbers, underscores, or dots
430
- - Cannot contain `$` or the null character
429
+ - Contain only letters, numbers, underscore characters, or dots
430
+ - Can't contain `$` or the null character
431
431
  - Example: `my_collection.123` is valid
432
- - Example: `my-index` is not valid (contains hyphen)
433
- - Example: `My$Collection` is not valid (contains `$`)
432
+ - Example: `my-index` isn't valid (contains hyphen)
433
+ - Example: `My$Collection` isn't valid (contains `$`)
434
434
 
435
435
  **PgVector**:
436
436
 
437
437
  Index names must:
438
438
 
439
439
  - Start with a letter or underscore
440
- - Contain only letters, numbers, and underscores
440
+ - Contain only letters, numbers, and underscore characters
441
441
  - Example: `my_index_123` is valid
442
- - Example: `my-index` is not valid (contains hyphen)
442
+ - Example: `my-index` isn't valid (contains hyphen)
443
443
 
444
444
  **OracleDB**:
445
445
 
@@ -466,7 +466,7 @@ Index names must:
466
466
  - Have a combined length (with project ID) under 52 characters
467
467
 
468
468
  - Example: `my-index-123` is valid
469
- - Example: `my.index` is not valid (contains dot)
469
+ - Example: `my.index` isn't valid (contains dot)
470
470
 
471
471
  **Qdrant**:
472
472
 
@@ -482,7 +482,7 @@ Collection names must:
482
482
 
483
483
  - Example: `my_collection_123` is valid
484
484
 
485
- - Example: `my/collection` is not valid (contains slash)
485
+ - Example: `my/collection` isn't valid (contains slash)
486
486
 
487
487
  **Chroma**:
488
488
 
@@ -490,11 +490,11 @@ Collection names must:
490
490
 
491
491
  - Be 3-63 characters long
492
492
  - Start and end with a letter or number
493
- - Contain only letters, numbers, underscores, or hyphens
493
+ - Contain only letters, numbers, underscore characters, or hyphens
494
494
  - Not contain consecutive periods (..)
495
495
  - Not be a valid IPv4 address
496
496
  - Example: `my-collection-123` is valid
497
- - Example: `my..collection` is not valid (consecutive periods)
497
+ - Example: `my..collection` isn't valid (consecutive periods)
498
498
 
499
499
  **Astra**:
500
500
 
@@ -502,18 +502,18 @@ Collection names must:
502
502
 
503
503
  - Not be empty
504
504
  - Be 48 characters or less
505
- - Contain only letters, numbers, and underscores
505
+ - Contain only letters, numbers, and `_` characters
506
506
  - Example: `my_collection_123` is valid
507
- - Example: `my-collection` is not valid (contains hyphen)
507
+ - Example: `my-collection` isn't valid (contains hyphen)
508
508
 
509
509
  **libSQL**:
510
510
 
511
511
  Index names must:
512
512
 
513
513
  - Start with a letter or underscore
514
- - Contain only letters, numbers, and underscores
514
+ - Contain only letters, numbers, and `_` characters
515
515
  - Example: `my_index_123` is valid
516
- - Example: `my-index` is not valid (contains hyphen)
516
+ - Example: `my-index` isn't valid (contains hyphen)
517
517
 
518
518
  **Upstash**:
519
519
 
@@ -532,7 +532,7 @@ Namespace names must:
532
532
 
533
533
  - Example: `MyNamespace123` is valid
534
534
 
535
- - Example: `_namespace` is not valid (starts with underscore)
535
+ - Example: `_namespace` isn't valid (starts with underscore)
536
536
 
537
537
  **Cloudflare**:
538
538
 
@@ -543,19 +543,19 @@ Index names must:
543
543
  - Contain only lowercase ASCII letters, numbers, and dashes
544
544
  - Use dashes instead of spaces
545
545
  - Example: `my-index-123` is valid
546
- - Example: `My_Index` is not valid (uppercase and underscore)
546
+ - Example: `My_Index` isn't valid (uppercase and underscore)
547
547
 
548
548
  **OpenSearch**:
549
549
 
550
550
  Index names must:
551
551
 
552
552
  - Use only lowercase letters
553
- - Not begin with underscores or hyphens
553
+ - Not begin with underscore characters or hyphens
554
554
  - Not contain spaces, commas
555
555
  - Not contain special characters (e.g. `:`, `"`, `*`, `+`, `/`, `\`, `|`, `?`, `#`, `>`, `<`)
556
556
  - Example: `my-index-123` is valid
557
- - Example: `My_Index` is not valid (contains uppercase letters)
558
- - Example: `_myindex` is not valid (begins with underscore)
557
+ - Example: `My_Index` isn't valid (contains uppercase letters)
558
+ - Example: `_myindex` isn't valid (begins with underscore)
559
559
 
560
560
  **Elasticsearch**:
561
561
 
@@ -563,29 +563,29 @@ Index names must:
563
563
 
564
564
  - Use only lowercase letters
565
565
  - Not exceed 255 bytes (counting multi-byte characters)
566
- - Not begin with underscores, hyphens, or plus signs
566
+ - Not begin with underscore characters, hyphens, or plus signs
567
567
  - Not contain spaces, commas
568
568
  - Not contain special characters (e.g. `:`, `"`, `*`, `+`, `/`, `\`, `|`, `?`, `#`, `>`, `<`)
569
569
  - Not be "." or ".."
570
570
  - Not start with "." (deprecated except for system/hidden indices)
571
571
  - Example: `my-index-123` is valid
572
- - Example: `My_Index` is not valid (contains uppercase letters)
573
- - Example: `_myindex` is not valid (begins with underscore)
574
- - Example: `.myindex` is not valid (begins with dot, deprecated)
572
+ - Example: `My_Index` isn't valid (contains uppercase letters)
573
+ - Example: `_myindex` isn't valid (begins with underscore)
574
+ - Example: `.myindex` isn't valid (begins with dot, deprecated)
575
575
 
576
576
  **S3 Vectors**:
577
577
 
578
578
  Index names must:
579
579
 
580
580
  - Be unique within the same vector bucket
581
- - Be 3–63 characters long
581
+ - Be between 3 and 63 characters long
582
582
  - Use only lowercase letters (`a–z`), numbers (`0–9`), hyphens (`-`), and dots (`.`)
583
583
  - Begin and end with a letter or number
584
584
  - Example: `my-index.123` is valid
585
- - Example: `my_index` is not valid (contains underscore)
586
- - Example: `-myindex` is not valid (begins with hyphen)
587
- - Example: `myindex-` is not valid (ends with hyphen)
588
- - Example: `MyIndex` is not valid (contains uppercase letters)
585
+ - Example: `my_index` isn't valid (contains underscore)
586
+ - Example: `-myindex` isn't valid (begins with hyphen)
587
+ - Example: `myindex-` isn't valid (ends with hyphen)
588
+ - Example: `MyIndex` isn't valid (contains uppercase letters)
589
589
 
590
590
  ### Upserting Embeddings
591
591
 
@@ -255,7 +255,7 @@ const thread = await memoryStore?.getThreadById({ threadId: '...' })
255
255
 
256
256
  ## Closing connections
257
257
 
258
- `close()` releases the connections of the stores a composite was built from: the `default` and `editor` stores, plus any domain that owns its own client. Each store is closed once, even when it backs several domains. When passed to the Mastra class, `close()` is called by `shutdown()`:
258
+ `close()` releases connections for the stores used by a composite, including the `default` and `editor` stores and any domain with its own client. Each store closes once even if it backs several domains. When the composite is passed to the Mastra class, `shutdown()` calls `close()`:
259
259
 
260
260
  ```typescript
261
261
  import { MastraCompositeStore } from '@mastra/core/storage'
@@ -222,7 +222,7 @@ const results = await store.textQuery({
222
222
 
223
223
  ### `hybridQuery()`
224
224
 
225
- Runs a hybrid search that fuses vector similarity and full-text results using MongoDB's server-side `$rankFusion`. It requires MongoDB >= 8.0 and is generally available from 8.1. On 8.0.x, it may require a MongoDB support case for enablement. It runs where enabled, including MongoDB Atlas 8.0.x. A full-text search index must exist: it's auto-created for managed indexes, but for a bring-your-own collection you must call `createSearchIndex()` first (opt-in).
225
+ Runs a hybrid search that fuses vector similarity with full-text results through MongoDB's server-side `$rankFusion`. The feature requires MongoDB 8.0 or later and is generally available from 8.1. MongoDB Atlas 8.0.x supports it where enabled, although enablement may require a support case. A full-text search index must exist. Managed indexes create one automatically, while bring-your-own collections require an explicit `createSearchIndex()` call.
226
226
 
227
227
  **indexName** (`string`): Name of the Mastra index to search
228
228
 
@@ -255,7 +255,7 @@ const results = await store.hybridQuery({
255
255
  })
256
256
  ```
257
257
 
258
- `hybridQuery()` requires MongoDB >= 8.0 for the `$rankFusion` stage. The stage is generally available from 8.1. On 8.0.x, it may need a MongoDB support case to enable and runs where enabled, such as MongoDB Atlas 8.0.x. If you're running an older version, or `$rankFusion` isn't enabled on your 8.0.x deployment, use `query()` and `textQuery()` separately and merge the results client-side.
258
+ `hybridQuery()` requires MongoDB 8.0 or later for the `$rankFusion` stage, which is generally available from 8.1. On 8.0.x, the stage runs where enabled, including MongoDB Atlas, but enablement may require a support case. If your deployment is older or lacks `$rankFusion`, run `query()` and `textQuery()` separately before merging the results client-side.
259
259
 
260
260
  ### `describeIndex()`
261
261
 
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
10
10
  let _mastra_core_evals = require("@mastra/core/evals");
11
11
  let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
12
12
  //#region package.json
13
- var version = "1.18.4";
13
+ var version = "1.18.5-alpha.1";
14
14
  //#endregion
15
15
  //#region src/vector/filter.ts
16
16
  /**
@@ -10897,6 +10897,7 @@ function docToDefinition(doc) {
10897
10897
  if (doc.metadata != null) def.metadata = doc.metadata;
10898
10898
  if (doc.stateSchema != null) def.stateSchema = doc.stateSchema;
10899
10899
  if (doc.requestContextSchema != null) def.requestContextSchema = doc.requestContextSchema;
10900
+ if (doc.schedule != null) def.schedule = doc.schedule;
10900
10901
  if (doc.authorId != null) def.authorId = doc.authorId;
10901
10902
  return def;
10902
10903
  }
@@ -10963,6 +10964,7 @@ var MongoDBWorkflowDefinitionsStore = class MongoDBWorkflowDefinitionsStore exte
10963
10964
  stateSchema: input.stateSchema ?? null,
10964
10965
  requestContextSchema: input.requestContextSchema ?? null,
10965
10966
  graph: input.graph,
10967
+ schedule: "schedule" in input ? input.schedule ?? null : null,
10966
10968
  status: "active",
10967
10969
  source: "storage",
10968
10970
  authorId: "authorId" in input ? input.authorId ?? null : null,
@@ -10989,6 +10991,7 @@ var MongoDBWorkflowDefinitionsStore = class MongoDBWorkflowDefinitionsStore exte
10989
10991
  if ("stateSchema" in input && input.stateSchema !== void 0) update.stateSchema = input.stateSchema;
10990
10992
  if ("requestContextSchema" in input && input.requestContextSchema !== void 0) update.requestContextSchema = input.requestContextSchema;
10991
10993
  if ("graph" in input && input.graph !== void 0) update.graph = input.graph;
10994
+ if ("schedule" in input && input.schedule !== void 0) update.schedule = input.schedule;
10992
10995
  if ("status" in input && input.status !== void 0) update.status = input.status;
10993
10996
  if ("authorId" in input && input.authorId !== void 0) update.authorId = input.authorId;
10994
10997
  await collection.updateOne({ id: input.id }, { $set: update });