@mastra/mongodb 1.26.0-alpha.2 → 1.27.0-alpha.0
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.
- package/dist/docs/SKILL.md +1 -14
- package/dist/docs/assets/SOURCE_MAP.json +113 -2
- package/dist/index.cjs +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/docs/references/docs-memory-semantic-recall.md +0 -485
- package/dist/docs/references/docs-memory-working-memory.md +0 -450
- package/dist/docs/references/docs-storage.md +0 -224
- package/dist/docs/references/reference-rag-retrieval.md +0 -672
- package/dist/docs/references/reference-rag-vector-databases.md +0 -808
- package/dist/docs/references/reference-storage-composite.md +0 -433
- package/dist/docs/references/reference-storage-retention.md +0 -310
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.
|
|
6
|
+
version: "1.27.0-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -14,23 +14,10 @@ Use this skill whenever you are working with @mastra/mongodb to obtain the domai
|
|
|
14
14
|
|
|
15
15
|
Read the individual reference documents for detailed explanations and code examples.
|
|
16
16
|
|
|
17
|
-
### Docs
|
|
18
|
-
|
|
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
|
-
|
|
23
17
|
### Integrations
|
|
24
18
|
|
|
25
19
|
- [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
20
|
- [MongoDB](references/integrations-vectors-mongodb.md) - Run MongoDB Vector Search from Mastra with automatic or manual embedding, metadata filtering, hybrid search, and indexing of existing collections.
|
|
27
21
|
|
|
28
|
-
### Reference
|
|
29
|
-
|
|
30
|
-
- [Retrieval, semantic search, reranking](references/reference-rag-retrieval.md) - After storing embeddings, you need to retrieve relevant chunks to answer user queries.
|
|
31
|
-
- [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.
|
|
32
|
-
- [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.
|
|
33
|
-
- [Reference: Storage retention (prune)](references/reference-storage-retention.md) - prune() deletes rows. It caps growth and is safe to run against large tables (batched, bounded, resumable, cancellable).
|
|
34
|
-
|
|
35
22
|
|
|
36
23
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,6 +1,117 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.27.0-alpha.0",
|
|
3
3
|
"package": "@mastra/mongodb",
|
|
4
|
-
"exports": {
|
|
4
|
+
"exports": {
|
|
5
|
+
"BackgroundTasksStorageMongoDB": {
|
|
6
|
+
"types": "dist/storage/domains/background-tasks/index.d.ts",
|
|
7
|
+
"implementation": "dist/index.js",
|
|
8
|
+
"line": 2476
|
|
9
|
+
},
|
|
10
|
+
"KnowledgeMongoDB": {
|
|
11
|
+
"types": "dist/storage/domains/knowledge/index.d.ts",
|
|
12
|
+
"implementation": "dist/index.js",
|
|
13
|
+
"line": 6860
|
|
14
|
+
},
|
|
15
|
+
"MONGODB_PROMPT": {
|
|
16
|
+
"types": "dist/vector/prompt.d.ts",
|
|
17
|
+
"implementation": "dist/index.js",
|
|
18
|
+
"line": 14450
|
|
19
|
+
},
|
|
20
|
+
"MemoryStorageMongoDB": {
|
|
21
|
+
"types": "dist/storage/domains/memory/index.d.ts",
|
|
22
|
+
"implementation": "dist/index.js",
|
|
23
|
+
"line": 8098
|
|
24
|
+
},
|
|
25
|
+
"MongoDBAgentsStorage": {
|
|
26
|
+
"types": "dist/storage/domains/agents/index.d.ts",
|
|
27
|
+
"implementation": "dist/index.js",
|
|
28
|
+
"line": 1750
|
|
29
|
+
},
|
|
30
|
+
"MongoDBBlobStore": {
|
|
31
|
+
"types": "dist/storage/domains/blobs/index.d.ts",
|
|
32
|
+
"implementation": "dist/index.js",
|
|
33
|
+
"line": 2682
|
|
34
|
+
},
|
|
35
|
+
"MongoDBDatasetsStorage": {
|
|
36
|
+
"types": "dist/storage/domains/datasets/index.d.ts",
|
|
37
|
+
"implementation": "dist/index.js",
|
|
38
|
+
"line": 2861
|
|
39
|
+
},
|
|
40
|
+
"MongoDBExperimentsStorage": {
|
|
41
|
+
"types": "dist/storage/domains/experiments/index.d.ts",
|
|
42
|
+
"implementation": "dist/index.js",
|
|
43
|
+
"line": 4112
|
|
44
|
+
},
|
|
45
|
+
"MongoDBMCPClientsStorage": {
|
|
46
|
+
"types": "dist/storage/domains/mcp-clients/index.d.ts",
|
|
47
|
+
"implementation": "dist/index.js",
|
|
48
|
+
"line": 7014
|
|
49
|
+
},
|
|
50
|
+
"MongoDBMCPServersStorage": {
|
|
51
|
+
"types": "dist/storage/domains/mcp-servers/index.d.ts",
|
|
52
|
+
"implementation": "dist/index.js",
|
|
53
|
+
"line": 7467
|
|
54
|
+
},
|
|
55
|
+
"MongoDBPromptBlocksStorage": {
|
|
56
|
+
"types": "dist/storage/domains/prompt-blocks/index.d.ts",
|
|
57
|
+
"implementation": "dist/index.js",
|
|
58
|
+
"line": 11185
|
|
59
|
+
},
|
|
60
|
+
"MongoDBScorerDefinitionsStorage": {
|
|
61
|
+
"types": "dist/storage/domains/scorer-definitions/index.d.ts",
|
|
62
|
+
"implementation": "dist/index.js",
|
|
63
|
+
"line": 11895
|
|
64
|
+
},
|
|
65
|
+
"MongoDBSkillsStorage": {
|
|
66
|
+
"types": "dist/storage/domains/skills/index.d.ts",
|
|
67
|
+
"implementation": "dist/index.js",
|
|
68
|
+
"line": 12725
|
|
69
|
+
},
|
|
70
|
+
"MongoDBStore": {
|
|
71
|
+
"types": "dist/storage/index.d.ts",
|
|
72
|
+
"implementation": "dist/index.js",
|
|
73
|
+
"line": 14371
|
|
74
|
+
},
|
|
75
|
+
"MongoDBVector": {
|
|
76
|
+
"types": "dist/vector/index.d.ts",
|
|
77
|
+
"implementation": "dist/index.js",
|
|
78
|
+
"line": 97
|
|
79
|
+
},
|
|
80
|
+
"MongoDBWorkflowDefinitionsStore": {
|
|
81
|
+
"types": "dist/storage/domains/workflow-definitions/index.d.ts",
|
|
82
|
+
"implementation": "dist/index.js",
|
|
83
|
+
"line": 13226
|
|
84
|
+
},
|
|
85
|
+
"MongoDBWorkspacesStorage": {
|
|
86
|
+
"types": "dist/storage/domains/workspaces/index.d.ts",
|
|
87
|
+
"implementation": "dist/index.js",
|
|
88
|
+
"line": 13869
|
|
89
|
+
},
|
|
90
|
+
"NotificationsMongoDB": {
|
|
91
|
+
"types": "dist/storage/domains/notifications/index.d.ts",
|
|
92
|
+
"implementation": "dist/index.js",
|
|
93
|
+
"line": 10213
|
|
94
|
+
},
|
|
95
|
+
"ObservabilityMongoDB": {
|
|
96
|
+
"types": "dist/storage/domains/observability/index.d.ts",
|
|
97
|
+
"implementation": "dist/index.js",
|
|
98
|
+
"line": 10503
|
|
99
|
+
},
|
|
100
|
+
"SchedulesMongoDB": {
|
|
101
|
+
"types": "dist/storage/domains/schedules/index.d.ts",
|
|
102
|
+
"implementation": "dist/index.js",
|
|
103
|
+
"line": 11692
|
|
104
|
+
},
|
|
105
|
+
"ScoresStorageMongoDB": {
|
|
106
|
+
"types": "dist/storage/domains/scores/index.d.ts",
|
|
107
|
+
"implementation": "dist/index.js",
|
|
108
|
+
"line": 12344
|
|
109
|
+
},
|
|
110
|
+
"WorkflowsStorageMongoDB": {
|
|
111
|
+
"types": "dist/storage/domains/workflows/index.d.ts",
|
|
112
|
+
"implementation": "dist/index.js",
|
|
113
|
+
"line": 13360
|
|
114
|
+
}
|
|
115
|
+
},
|
|
5
116
|
"modules": {}
|
|
6
117
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
11
11
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
12
12
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "1.
|
|
14
|
+
var version = "1.27.0-alpha.0";
|
|
15
15
|
// src/vector/filter.ts
|
|
16
16
|
/**
|
|
17
17
|
* Translator for MongoDB filter queries.
|
|
@@ -8259,14 +8259,16 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_stora
|
|
|
8259
8259
|
collection: _mastra_core_storage.TABLE_THREADS,
|
|
8260
8260
|
keys: {
|
|
8261
8261
|
resourceId: 1,
|
|
8262
|
-
createdAt: -1
|
|
8262
|
+
createdAt: -1,
|
|
8263
|
+
id: -1
|
|
8263
8264
|
}
|
|
8264
8265
|
},
|
|
8265
8266
|
{
|
|
8266
8267
|
collection: _mastra_core_storage.TABLE_THREADS,
|
|
8267
8268
|
keys: {
|
|
8268
8269
|
resourceId: 1,
|
|
8269
|
-
updatedAt: -1
|
|
8270
|
+
updatedAt: -1,
|
|
8271
|
+
id: -1
|
|
8270
8272
|
}
|
|
8271
8273
|
},
|
|
8272
8274
|
{
|
|
@@ -8934,7 +8936,10 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_stora
|
|
|
8934
8936
|
hasMore: offset < total
|
|
8935
8937
|
};
|
|
8936
8938
|
const sortOrder = direction === "ASC" ? 1 : -1;
|
|
8937
|
-
let cursor = collection.find(query).sort({
|
|
8939
|
+
let cursor = collection.find(query).sort({
|
|
8940
|
+
[field]: sortOrder,
|
|
8941
|
+
id: sortOrder
|
|
8942
|
+
}).skip(offset);
|
|
8938
8943
|
if (perPageInput !== false) cursor = cursor.limit(perPage);
|
|
8939
8944
|
return {
|
|
8940
8945
|
threads: (await cursor.toArray()).map((thread) => ({
|
|
@@ -11629,7 +11634,9 @@ function scheduleToDoc(schedule) {
|
|
|
11629
11634
|
updated_at: schedule.updatedAt,
|
|
11630
11635
|
metadata: schedule.metadata ?? null,
|
|
11631
11636
|
owner_type: schedule.ownerType ?? null,
|
|
11632
|
-
owner_id: schedule.ownerId ?? null
|
|
11637
|
+
owner_id: schedule.ownerId ?? null,
|
|
11638
|
+
run_at: schedule.runAt ?? null,
|
|
11639
|
+
end_at: schedule.endAt ?? null
|
|
11633
11640
|
};
|
|
11634
11641
|
}
|
|
11635
11642
|
function docToSchedule(doc) {
|
|
@@ -11650,6 +11657,8 @@ function docToSchedule(doc) {
|
|
|
11650
11657
|
if (doc.metadata != null) schedule.metadata = doc.metadata;
|
|
11651
11658
|
if (doc.owner_type != null) schedule.ownerType = String(doc.owner_type);
|
|
11652
11659
|
if (doc.owner_id != null) schedule.ownerId = String(doc.owner_id);
|
|
11660
|
+
if (doc.run_at != null) schedule.runAt = Number(doc.run_at);
|
|
11661
|
+
if (doc.end_at != null) schedule.endAt = Number(doc.end_at);
|
|
11653
11662
|
return schedule;
|
|
11654
11663
|
}
|
|
11655
11664
|
function triggerToDoc(trigger) {
|
|
@@ -11828,6 +11837,8 @@ var SchedulesMongoDB = class SchedulesMongoDB extends _mastra_core_storage.Sched
|
|
|
11828
11837
|
if ("metadata" in patch) $set.metadata = patch.metadata ?? null;
|
|
11829
11838
|
if ("ownerType" in patch) $set.owner_type = patch.ownerType ?? null;
|
|
11830
11839
|
if ("ownerId" in patch) $set.owner_id = patch.ownerId ?? null;
|
|
11840
|
+
if ("runAt" in patch) $set.run_at = patch.runAt ?? null;
|
|
11841
|
+
if ("endAt" in patch) $set.end_at = patch.endAt ?? null;
|
|
11831
11842
|
$set.updated_at = Date.now();
|
|
11832
11843
|
const result = await (await this.getSchedulesCollection()).findOneAndUpdate({ id }, { $set }, { returnDocument: "after" });
|
|
11833
11844
|
if (!result) throw new Error(`Schedule ${id} not found`);
|