@mastra/mongodb 1.0.0-beta.10 → 1.0.0-beta.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,97 @@
1
1
  # @mastra/mongodb
2
2
 
3
+ ## 1.0.0-beta.12
4
+
5
+ ### Minor Changes
6
+
7
+ - Add configurable embeddingFieldPath option to MongoDBVector constructor. This allows users to specify custom paths for storing vector embeddings, including nested document paths using dot notation (e.g., text.contentEmbedding). Defaults to 'embedding' for backward compatibility. ([#11944](https://github.com/mastra-ai/mastra/pull/11944))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fix MongoDB scores storage sort logic to use numeric sort values (-1) instead of string values ('desc') for consistency with other MongoDB domains (agents, memory, observability, workflows). ([#11729](https://github.com/mastra-ai/mastra/pull/11729))
12
+
13
+ - Fix MongoDB connection string parameter naming inconsistency. MongoDBVector now uses uri parameter (correct MongoDB terminology). MongoDBStore now accepts both uri (recommended) and url (deprecated, for backward compatibility). Added clear error messages when connection string is missing. ([#11728](https://github.com/mastra-ai/mastra/pull/11728))
14
+
15
+ - Aligned vector store configuration with underlying library APIs, giving you access to all library options directly. ([#11742](https://github.com/mastra-ai/mastra/pull/11742))
16
+
17
+ **Why this change?**
18
+
19
+ Previously, each vector store defined its own configuration types that only exposed a subset of the underlying library's options. This meant users couldn't access advanced features like authentication, SSL, compression, or custom headers without creating their own client instances. Now, the configuration types extend the library types directly, so all options are available.
20
+
21
+ **@mastra/libsql** (Breaking)
22
+
23
+ Renamed `connectionUrl` to `url` to match the `@libsql/client` API and align with LibSQLStorage.
24
+
25
+ ```typescript
26
+ // Before
27
+ new LibSQLVector({ id: 'my-vector', connectionUrl: 'file:./db.sqlite' });
28
+
29
+ // After
30
+ new LibSQLVector({ id: 'my-vector', url: 'file:./db.sqlite' });
31
+ ```
32
+
33
+ **@mastra/opensearch** (Breaking)
34
+
35
+ Renamed `url` to `node` and added support for all OpenSearch `ClientOptions` including authentication, SSL, and compression.
36
+
37
+ ```typescript
38
+ // Before
39
+ new OpenSearchVector({ id: 'my-vector', url: 'http://localhost:9200' });
40
+
41
+ // After
42
+ new OpenSearchVector({ id: 'my-vector', node: 'http://localhost:9200' });
43
+
44
+ // With authentication (now possible)
45
+ new OpenSearchVector({
46
+ id: 'my-vector',
47
+ node: 'https://localhost:9200',
48
+ auth: { username: 'admin', password: 'admin' },
49
+ ssl: { rejectUnauthorized: false },
50
+ });
51
+ ```
52
+
53
+ **@mastra/pinecone** (Breaking)
54
+
55
+ Removed `environment` parameter. Use `controllerHostUrl` instead (the actual Pinecone SDK field name). Added support for all `PineconeConfiguration` options.
56
+
57
+ ```typescript
58
+ // Before
59
+ new PineconeVector({ id: 'my-vector', apiKey: '...', environment: '...' });
60
+
61
+ // After
62
+ new PineconeVector({ id: 'my-vector', apiKey: '...' });
63
+
64
+ // With custom controller host (if needed)
65
+ new PineconeVector({ id: 'my-vector', apiKey: '...', controllerHostUrl: '...' });
66
+ ```
67
+
68
+ **@mastra/clickhouse**
69
+
70
+ Added support for all `ClickHouseClientConfigOptions` like `request_timeout`, `compression`, `keep_alive`, and `database`. Existing configurations continue to work unchanged.
71
+
72
+ **@mastra/cloudflare, @mastra/cloudflare-d1, @mastra/lance, @mastra/libsql, @mastra/mongodb, @mastra/pg, @mastra/upstash**
73
+
74
+ Improved logging by replacing `console.warn` with structured logger in workflow storage domains.
75
+
76
+ **@mastra/deployer-cloud**
77
+
78
+ Updated internal LibSQLVector configuration for compatibility with the new API.
79
+
80
+ - Updated dependencies [[`ebae12a`](https://github.com/mastra-ai/mastra/commit/ebae12a2dd0212e75478981053b148a2c246962d), [`c61a0a5`](https://github.com/mastra-ai/mastra/commit/c61a0a5de4904c88fd8b3718bc26d1be1c2ec6e7), [`69136e7`](https://github.com/mastra-ai/mastra/commit/69136e748e32f57297728a4e0f9a75988462f1a7), [`449aed2`](https://github.com/mastra-ai/mastra/commit/449aed2ba9d507b75bf93d427646ea94f734dfd1), [`eb648a2`](https://github.com/mastra-ai/mastra/commit/eb648a2cc1728f7678768dd70cd77619b448dab9), [`0131105`](https://github.com/mastra-ai/mastra/commit/0131105532e83bdcbb73352fc7d0879eebf140dc), [`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`b00ccd3`](https://github.com/mastra-ai/mastra/commit/b00ccd325ebd5d9e37e34dd0a105caae67eb568f), [`3bdfa75`](https://github.com/mastra-ai/mastra/commit/3bdfa7507a91db66f176ba8221aa28dd546e464a), [`e770de9`](https://github.com/mastra-ai/mastra/commit/e770de941a287a49b1964d44db5a5763d19890a6), [`52e2716`](https://github.com/mastra-ai/mastra/commit/52e2716b42df6eff443de72360ae83e86ec23993), [`27b4040`](https://github.com/mastra-ai/mastra/commit/27b4040bfa1a95d92546f420a02a626b1419a1d6), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151), [`8dc7f55`](https://github.com/mastra-ai/mastra/commit/8dc7f55900395771da851dc7d78d53ae84fe34ec), [`8379099`](https://github.com/mastra-ai/mastra/commit/8379099fc467af6bef54dd7f80c9bd75bf8bbddf), [`8c0ec25`](https://github.com/mastra-ai/mastra/commit/8c0ec25646c8a7df253ed1e5ff4863a0d3f1316c), [`ff4d9a6`](https://github.com/mastra-ai/mastra/commit/ff4d9a6704fc87b31a380a76ed22736fdedbba5a), [`69821ef`](https://github.com/mastra-ai/mastra/commit/69821ef806482e2c44e2197ac0b050c3fe3a5285), [`1ed5716`](https://github.com/mastra-ai/mastra/commit/1ed5716830867b3774c4a1b43cc0d82935f32b96), [`4186bdd`](https://github.com/mastra-ai/mastra/commit/4186bdd00731305726fa06adba0b076a1d50b49f), [`7aaf973`](https://github.com/mastra-ai/mastra/commit/7aaf973f83fbbe9521f1f9e7a4fd99b8de464617)]:
81
+ - @mastra/core@1.0.0-beta.22
82
+
83
+ ## 1.0.0-beta.11
84
+
85
+ ### Patch Changes
86
+
87
+ - dependencies updates: ([#10114](https://github.com/mastra-ai/mastra/pull/10114))
88
+ - Updated dependency [`uuid@^13.0.0` ↗︎](https://www.npmjs.com/package/uuid/v/13.0.0) (from `^11.1.0`, in `dependencies`)
89
+
90
+ - dependencies updates: ([#10196](https://github.com/mastra-ai/mastra/pull/10196))
91
+ - Updated dependency [`mongodb@^7.0.0` ↗︎](https://www.npmjs.com/package/mongodb/v/7.0.0) (from `^6.17.0`, in `dependencies`)
92
+ - Updated dependencies [[`08766f1`](https://github.com/mastra-ai/mastra/commit/08766f15e13ac0692fde2a8bd366c2e16e4321df), [`ae8baf7`](https://github.com/mastra-ai/mastra/commit/ae8baf7d8adcb0ff9dac11880400452bc49b33ff), [`cfabdd4`](https://github.com/mastra-ai/mastra/commit/cfabdd4aae7a726b706942d6836eeca110fb6267), [`a0e437f`](https://github.com/mastra-ai/mastra/commit/a0e437fac561b28ee719e0302d72b2f9b4c138f0), [`bec5efd`](https://github.com/mastra-ai/mastra/commit/bec5efde96653ccae6604e68c696d1bc6c1a0bf5), [`9eedf7d`](https://github.com/mastra-ai/mastra/commit/9eedf7de1d6e0022a2f4e5e9e6fe1ec468f9b43c)]:
93
+ - @mastra/core@1.0.0-beta.21
94
+
3
95
  ## 1.0.0-beta.10
4
96
 
5
97
  ### Patch Changes
package/README.md CHANGED
@@ -21,6 +21,7 @@ npm install @mastra/mongodb
21
21
  import { MongoDBVector } from '@mastra/mongodb';
22
22
 
23
23
  const vectorDB = new MongoDBVector({
24
+ id: 'mongodb-vector',
24
25
  uri: 'mongodb://mongodb:mongodb@localhost:27018/?authSource=admin&directConnection=true',
25
26
  dbName: 'vector_db',
26
27
  });
@@ -62,6 +63,7 @@ await vectorDB.disconnect();
62
63
  import { MongoDBStore } from '@mastra/mongodb';
63
64
 
64
65
  const store = new MongoDBStore({
66
+ id: 'mongodb-store',
65
67
  uri: 'mongodb://mongodb:mongodb@localhost:27018/?authSource=admin&directConnection=true',
66
68
  dbName: 'mastra',
67
69
  });
@@ -100,18 +102,34 @@ const { messages } = await store.listMessages({ threadId: 'thread-123' });
100
102
 
101
103
  The MongoDB vector store is initialized with:
102
104
 
105
+ - `id`: Unique identifier for this store instance
103
106
  - `uri`: MongoDB connection string (with credentials and options)
104
107
  - `dbName`: Name of the database to use
108
+ - `embeddingFieldPath` (optional): Path to the field that stores vector embeddings. Supports nested paths using dot notation (e.g., `'text.contentEmbedding'`). Defaults to `'embedding'`.
105
109
 
106
110
  Example:
107
111
 
108
112
  ```typescript
109
113
  const vectorDB = new MongoDBVector({
114
+ id: 'mongodb-vector',
110
115
  uri: 'mongodb://mongodb:mongodb@localhost:27018/?authSource=admin&directConnection=true',
111
116
  dbName: 'vector_db',
112
117
  });
113
118
  ```
114
119
 
120
+ ### Custom Embedding Field Path
121
+
122
+ If you need to store embeddings in a nested field structure, use the `embeddingFieldPath` option:
123
+
124
+ ```typescript
125
+ const vectorDB = new MongoDBVector({
126
+ id: 'mongodb-vector',
127
+ uri: 'mongodb://mongodb:mongodb@localhost:27018/?authSource=admin&directConnection=true',
128
+ dbName: 'vector_db',
129
+ embeddingFieldPath: 'text.contentEmbedding', // Store embeddings at text.contentEmbedding
130
+ });
131
+ ```
132
+
115
133
  ## Features
116
134
 
117
135
  ### Vector Store Features
@@ -31,4 +31,4 @@ docs/
31
31
  ## Version
32
32
 
33
33
  Package: @mastra/mongodb
34
- Version: 1.0.0-beta.10
34
+ Version: 1.0.0-beta.12
@@ -5,7 +5,7 @@ description: Documentation for @mastra/mongodb. Includes links to type definitio
5
5
 
6
6
  # @mastra/mongodb Documentation
7
7
 
8
- > **Version**: 1.0.0-beta.10
8
+ > **Version**: 1.0.0-beta.12
9
9
  > **Package**: @mastra/mongodb
10
10
 
11
11
  ## Quick Navigation
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-beta.10",
2
+ "version": "1.0.0-beta.12",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -80,13 +80,15 @@ const memory = new Memory({
80
80
 
81
81
  ### Usage with Agents
82
82
 
83
- When using resource-scoped memory, make sure to pass the `resourceId` parameter:
83
+ When using resource-scoped memory, make sure to pass the `resource` parameter in the memory options:
84
84
 
85
85
  ```typescript
86
- // Resource-scoped memory requires resourceId
86
+ // Resource-scoped memory requires resource
87
87
  const response = await agent.generate("Hello!", {
88
- threadId: "conversation-123",
89
- resourceId: "user-alice-456", // Same user across different threads
88
+ memory: {
89
+ thread: "conversation-123",
90
+ resource: "user-alice-456", // Same user across different threads
91
+ },
90
92
  });
91
93
  ```
92
94
 
@@ -339,8 +341,10 @@ const thread = await memory.createThread({
339
341
 
340
342
  // The agent will now have access to this information in all messages
341
343
  await agent.generate("What's my blood type?", {
342
- threadId: thread.id,
343
- resourceId: "user-456",
344
+ memory: {
345
+ thread: thread.id,
346
+ resource: "user-456",
347
+ },
344
348
  });
345
349
  // Response: "Your blood type is O+."
346
350
  ```
@@ -12,6 +12,7 @@ After generating embeddings, you need to store them in a database that supports
12
12
  import { MongoDBVector } from "@mastra/mongodb";
13
13
 
14
14
  const store = new MongoDBVector({
15
+ id: 'mongodb-vector',
15
16
  uri: process.env.MONGODB_URI,
16
17
  dbName: process.env.MONGODB_DATABASE,
17
18
  });
@@ -144,6 +145,7 @@ await store.upsert({
144
145
  import { AstraVector } from "@mastra/astra";
145
146
 
146
147
  const store = new AstraVector({
148
+ id: 'astra-vector',
147
149
  token: process.env.ASTRA_DB_TOKEN,
148
150
  endpoint: process.env.ASTRA_DB_ENDPOINT,
149
151
  keyspace: process.env.ASTRA_DB_KEYSPACE,
@@ -170,7 +172,7 @@ import { LibSQLVector } from "@mastra/core/vector/libsql";
170
172
 
171
173
  const store = new LibSQLVector({
172
174
  id: 'libsql-vector',
173
- connectionUrl: process.env.DATABASE_URL,
175
+ url: process.env.DATABASE_URL,
174
176
  authToken: process.env.DATABASE_AUTH_TOKEN, // Optional: for Turso cloud databases
175
177
  });
176
178
 
@@ -217,6 +219,7 @@ await store.upsert({
217
219
  import { CloudflareVector } from "@mastra/vectorize";
218
220
 
219
221
  const store = new CloudflareVector({
222
+ id: 'cloudflare-vector',
220
223
  accountId: process.env.CF_ACCOUNT_ID,
221
224
  apiToken: process.env.CF_API_TOKEN,
222
225
  });
@@ -238,7 +241,7 @@ await store.upsert({
238
241
  ```ts title="vector-store.ts"
239
242
  import { OpenSearchVector } from "@mastra/opensearch";
240
243
 
241
- const store = new OpenSearchVector({ url: process.env.OPENSEARCH_URL });
244
+ const store = new OpenSearchVector({ id: "opensearch", node: process.env.OPENSEARCH_URL });
242
245
 
243
246
  await store.createIndex({
244
247
  indexName: "my-collection",
@@ -259,7 +262,7 @@ await store.upsert({
259
262
  ```ts title="vector-store.ts"
260
263
  import { ElasticSearchVector } from "@mastra/elasticsearch";
261
264
 
262
- const store = new ElasticSearchVector({ url: process.env.ELASTICSEARCH_URL });
265
+ const store = new ElasticSearchVector({ id: 'elasticsearch-vector', url: process.env.ELASTICSEARCH_URL });
263
266
 
264
267
  await store.createIndex({
265
268
  indexName: "my-collection",
@@ -280,6 +283,7 @@ await store.upsert({
280
283
  import { CouchbaseVector } from "@mastra/couchbase";
281
284
 
282
285
  const store = new CouchbaseVector({
286
+ id: 'couchbase-vector',
283
287
  connectionString: process.env.COUCHBASE_CONNECTION_STRING,
284
288
  username: process.env.COUCHBASE_USERNAME,
285
289
  password: process.env.COUCHBASE_PASSWORD,
@@ -331,6 +335,7 @@ For detailed setup instructions and best practices, see the [official LanceDB do
331
335
  import { S3Vectors } from "@mastra/s3vectors";
332
336
 
333
337
  const store = new S3Vectors({
338
+ id: 's3-vectors',
334
339
  vectorBucketName: "my-vector-bucket",
335
340
  clientConfig: {
336
341
  region: "us-east-1",
@@ -373,7 +378,7 @@ The dimension size must match the output dimension of your chosen embedding mode
373
378
  - Cohere embed-multilingual-v3: 1024 dimensions
374
379
  - Google text-embedding-004: 768 dimensions (or custom)
375
380
 
376
- important
381
+ > **Note:**
377
382
  Index dimensions cannot be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
378
383
 
379
384
  ### Naming Rules for Databases
@@ -537,7 +542,7 @@ The upsert operation:
537
542
 
538
543
  Vector stores support rich metadata (any JSON-serializable fields) for filtering and organization. Since metadata is stored with no fixed schema, use consistent field naming to avoid unexpected query results.
539
544
 
540
- important
545
+ > **Note:**
541
546
  Metadata is crucial for vector storage - without it, you'd only have numerical embeddings with no way to return the original text or filter results. Always store at least the source text as metadata.
542
547
 
543
548
  ```ts
@@ -171,7 +171,7 @@ The Vector Query Tool supports database-specific configurations that enable you
171
171
  > **Note:**
172
172
  These configurations are for **query-time options** like namespaces, performance tuning, and filtering—not for database connection setup.
173
173
 
174
- Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ connectionUrl: '...' })`).
174
+ Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
175
175
 
176
176
  ```ts
177
177
  import { createVectorQueryTool } from "@mastra/rag";
@@ -258,11 +258,10 @@ requestContext.set("databaseConfig", {
258
258
  },
259
259
  });
260
260
 
261
- await pineconeQueryTool.execute({
262
- context: { queryText: "search query" },
263
- mastra,
264
- requestContext,
265
- });
261
+ await pineconeQueryTool.execute(
262
+ { queryText: "search query" },
263
+ { mastra, requestContext }
264
+ );
266
265
  ```
267
266
 
268
267
  For detailed configuration options and advanced usage, see the [Vector Query Tool Reference](https://mastra.ai/reference/v1/tools/vector-query-tool).
@@ -25,13 +25,17 @@ Ensure you have a MongoDB Atlas Local (via Docker) or MongoDB Atlas Cloud instan
25
25
  import { MongoDBStore } from "@mastra/mongodb";
26
26
 
27
27
  const storage = new MongoDBStore({
28
- url: process.env.MONGODB_URL,
28
+ id: 'mongodb-storage',
29
+ uri: process.env.MONGODB_URI,
29
30
  dbName: process.env.MONGODB_DATABASE,
30
31
  });
31
32
  ```
32
33
 
33
34
  ## Parameters
34
35
 
36
+ > **Deprecation Notice**
37
+ The `url` parameter is deprecated but still supported for backward compatibility. Please use `uri` instead in all new code.
38
+
35
39
  ## Constructor Examples
36
40
 
37
41
  You can instantiate `MongoDBStore` in the following ways:
@@ -41,13 +45,15 @@ import { MongoDBStore } from "@mastra/mongodb";
41
45
 
42
46
  // Basic connection without custom options
43
47
  const store1 = new MongoDBStore({
44
- url: "mongodb+srv://user:password@cluster.mongodb.net",
48
+ id: 'mongodb-storage-01',
49
+ uri: "mongodb+srv://user:password@cluster.mongodb.net",
45
50
  dbName: "mastra_storage",
46
51
  });
47
52
 
48
53
  // Using connection string with options
49
54
  const store2 = new MongoDBStore({
50
- url: "mongodb+srv://user:password@cluster.mongodb.net",
55
+ id: 'mongodb-storage-02',
56
+ uri: "mongodb+srv://user:password@cluster.mongodb.net",
51
57
  dbName: "mastra_storage",
52
58
  options: {
53
59
  retryWrites: true,
@@ -81,7 +87,8 @@ import { Mastra } from "@mastra/core";
81
87
  import { MongoDBStore } from "@mastra/mongodb";
82
88
 
83
89
  const storage = new MongoDBStore({
84
- url: process.env.MONGODB_URL,
90
+ id: 'mongodb-storage',
91
+ uri: process.env.MONGODB_URI,
85
92
  dbName: process.env.MONGODB_DATABASE,
86
93
  });
87
94
 
@@ -97,7 +104,7 @@ import { MongoDBStore } from "@mastra/mongodb";
97
104
 
98
105
  const storage = new MongoDBStore({
99
106
  id: 'mongodb-storage',
100
- url: process.env.MONGODB_URL,
107
+ uri: process.env.MONGODB_URI,
101
108
  dbName: process.env.MONGODB_DATABASE,
102
109
  });
103
110
 
@@ -122,7 +129,8 @@ MongoDB storage includes built-in vector search capabilities for AI applications
122
129
  import { MongoDBVector } from "@mastra/mongodb";
123
130
 
124
131
  const vectorStore = new MongoDBVector({
125
- url: process.env.MONGODB_URL,
132
+ id: 'mongodb-vector',
133
+ uri: process.env.MONGODB_URI,
126
134
  dbName: process.env.MONGODB_DATABASE,
127
135
  });
128
136
 
@@ -182,13 +190,11 @@ export const mongodbAgent = new Agent({
182
190
  model: "openai/gpt-5.1",
183
191
  memory: new Memory({
184
192
  storage: new MongoDBStore({
185
- url: process.env.MONGODB_URI!,
193
+ uri: process.env.MONGODB_URI!,
186
194
  dbName: process.env.MONGODB_DB_NAME!,
187
195
  }),
188
196
  options: {
189
- threads: {
190
- generateTitle: true,
191
- },
197
+ generateTitle: true,
192
198
  },
193
199
  }),
194
200
  });
@@ -24,8 +24,23 @@ import { MongoDBVector } from "@mastra/mongodb";
24
24
 
25
25
  const store = new MongoDBVector({
26
26
  id: 'mongodb-vector',
27
- url: process.env.MONGODB_URL,
28
- database: process.env.MONGODB_DATABASE,
27
+ uri: process.env.MONGODB_URI,
28
+ dbName: process.env.MONGODB_DATABASE,
29
+ });
30
+ ```
31
+
32
+ ### Custom Embedding Field Path
33
+
34
+ If you need to store embeddings in a nested field structure (e.g., to integrate with existing MongoDB collections), use the `embeddingFieldPath` option:
35
+
36
+ ```typescript
37
+ import { MongoDBVector } from "@mastra/mongodb";
38
+
39
+ const store = new MongoDBVector({
40
+ id: 'mongodb-vector',
41
+ uri: process.env.MONGODB_URI,
42
+ dbName: process.env.MONGODB_DATABASE,
43
+ embeddingFieldPath: 'text.contentEmbedding', // Store embeddings at text.contentEmbedding
29
44
  });
30
45
  ```
31
46
 
@@ -159,10 +174,12 @@ export const mongodbAgent = new Agent({
159
174
  model: "openai/gpt-5.1",
160
175
  memory: new Memory({
161
176
  storage: new MongoDBStore({
162
- url: process.env.MONGODB_URI!,
177
+ id: 'mongodb-storage',
178
+ uri: process.env.MONGODB_URI!,
163
179
  dbName: process.env.MONGODB_DB_NAME!,
164
180
  }),
165
181
  vector: new MongoDBVector({
182
+ id: 'mongodb-vector',
166
183
  uri: process.env.MONGODB_URI!,
167
184
  dbName: process.env.MONGODB_DB_NAME!,
168
185
  }),
@@ -173,9 +190,7 @@ export const mongodbAgent = new Agent({
173
190
  topK: 3,
174
191
  messageRange: 2,
175
192
  },
176
- threads: {
177
- generateTitle: true, // generates descriptive thread titles automatically
178
- },
193
+ generateTitle: true, // generates descriptive thread titles automatically
179
194
  },
180
195
  }),
181
196
  });
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ var evals = require('@mastra/core/evals');
13
13
 
14
14
  // package.json
15
15
  var package_default = {
16
- version: "1.0.0-beta.10"};
16
+ version: "1.0.0-beta.12"};
17
17
  var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
18
18
  getSupportedOperators() {
19
19
  return {
@@ -107,7 +107,7 @@ var MongoDBVector = class extends vector.MastraVector {
107
107
  client;
108
108
  db;
109
109
  collections;
110
- embeddingFieldName = "embedding";
110
+ embeddingFieldName;
111
111
  metadataFieldName = "metadata";
112
112
  documentFieldName = "document";
113
113
  collectionForValidation = null;
@@ -116,8 +116,11 @@ var MongoDBVector = class extends vector.MastraVector {
116
116
  euclidean: "euclidean",
117
117
  dotproduct: "dotProduct"
118
118
  };
119
- constructor({ id, uri, dbName, options }) {
119
+ constructor({ id, uri, dbName, options, embeddingFieldPath }) {
120
120
  super({ id });
121
+ if (!uri) {
122
+ throw new Error('MongoDBVector requires a connection string. Provide "uri" in the constructor options.');
123
+ }
121
124
  const client = new mongodb.MongoClient(uri, {
122
125
  ...options,
123
126
  driverInfo: {
@@ -128,6 +131,7 @@ var MongoDBVector = class extends vector.MastraVector {
128
131
  this.client = client;
129
132
  this.db = this.client.db(dbName);
130
133
  this.collections = /* @__PURE__ */ new Map();
134
+ this.embeddingFieldName = embeddingFieldPath ?? "embedding";
131
135
  }
132
136
  // Public methods
133
137
  async connect() {
@@ -859,11 +863,21 @@ function resolveMongoDBConfig(config) {
859
863
  );
860
864
  }
861
865
  }
866
+ const connectionString = config.uri ?? config.url;
867
+ if (!connectionString) {
868
+ throw new error.MastraError({
869
+ id: storage.createStorageErrorId("MONGODB", "CONSTRUCTOR", "MISSING_URI"),
870
+ domain: error.ErrorDomain.STORAGE,
871
+ category: error.ErrorCategory.USER,
872
+ details: { dbName: config?.dbName },
873
+ text: 'MongoDBStore requires a connection string. Provide "uri" (recommended) or "url" in the constructor options.'
874
+ });
875
+ }
862
876
  try {
863
877
  return MongoDBConnector.fromDatabaseConfig({
864
878
  id: "id" in config ? config.id : "domain",
865
879
  options: config.options,
866
- url: config.url,
880
+ url: connectionString,
867
881
  dbName: config.dbName
868
882
  });
869
883
  } catch (error$1) {
@@ -872,7 +886,7 @@ function resolveMongoDBConfig(config) {
872
886
  id: storage.createStorageErrorId("MONGODB", "CONSTRUCTOR", "FAILED"),
873
887
  domain: error.ErrorDomain.STORAGE,
874
888
  category: error.ErrorCategory.USER,
875
- details: { url: config?.url, dbName: config?.dbName }
889
+ details: { uri: config?.uri ?? "", url: config?.url ?? "", dbName: config?.dbName ?? "" }
876
890
  },
877
891
  error$1
878
892
  );
@@ -2583,7 +2597,7 @@ var ScoresStorageMongoDB = class _ScoresStorageMongoDB extends storage.ScoresSto
2583
2597
  };
2584
2598
  }
2585
2599
  const end = perPageInput === false ? total : start + perPage;
2586
- let cursor = collection.find(query).sort({ createdAt: "desc" }).skip(start);
2600
+ let cursor = collection.find(query).sort({ createdAt: -1 }).skip(start);
2587
2601
  if (perPageInput !== false) {
2588
2602
  cursor = cursor.limit(perPage);
2589
2603
  }
@@ -2632,7 +2646,7 @@ var ScoresStorageMongoDB = class _ScoresStorageMongoDB extends storage.ScoresSto
2632
2646
  };
2633
2647
  }
2634
2648
  const end = perPageInput === false ? total : start + perPage;
2635
- let cursor = collection.find({ runId }).sort({ createdAt: "desc" }).skip(start);
2649
+ let cursor = collection.find({ runId }).sort({ createdAt: -1 }).skip(start);
2636
2650
  if (perPageInput !== false) {
2637
2651
  cursor = cursor.limit(perPage);
2638
2652
  }
@@ -2682,7 +2696,7 @@ var ScoresStorageMongoDB = class _ScoresStorageMongoDB extends storage.ScoresSto
2682
2696
  };
2683
2697
  }
2684
2698
  const end = perPageInput === false ? total : start + perPage;
2685
- let cursor = collection.find({ entityId, entityType }).sort({ createdAt: "desc" }).skip(start);
2699
+ let cursor = collection.find({ entityId, entityType }).sort({ createdAt: -1 }).skip(start);
2686
2700
  if (perPageInput !== false) {
2687
2701
  cursor = cursor.limit(perPage);
2688
2702
  }
@@ -2733,7 +2747,7 @@ var ScoresStorageMongoDB = class _ScoresStorageMongoDB extends storage.ScoresSto
2733
2747
  };
2734
2748
  }
2735
2749
  const end = perPageInput === false ? total : start + perPage;
2736
- let cursor = collection.find(query).sort({ createdAt: "desc" }).skip(start);
2750
+ let cursor = collection.find(query).sort({ createdAt: -1 }).skip(start);
2737
2751
  if (perPageInput !== false) {
2738
2752
  cursor = cursor.limit(perPage);
2739
2753
  }
@@ -3026,7 +3040,7 @@ var WorkflowsStorageMongoDB = class _WorkflowsStorageMongoDB extends storage.Wor
3026
3040
  try {
3027
3041
  parsedSnapshot = typeof row.snapshot === "string" ? storage.safelyParseJSON(row.snapshot) : row.snapshot;
3028
3042
  } catch (e) {
3029
- console.warn(`Failed to parse snapshot for workflow ${row.workflow_name}: ${e}`);
3043
+ this.logger.warn(`Failed to parse snapshot for workflow ${row.workflow_name}: ${e}`);
3030
3044
  }
3031
3045
  }
3032
3046
  return {