@mastra/mongodb 1.24.1-alpha.1 → 1.24.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.
@@ -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.24.1-alpha.1"
6
+ version: "1.24.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.24.1-alpha.1",
2
+ "version": "1.24.1",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -456,8 +456,10 @@ const agent = new Agent({
456
456
  indexConfig: {
457
457
  type: 'hnsw', // Use HNSW for better performance
458
458
  metric: 'dotproduct', // Best for OpenAI embeddings
459
- m: 16, // Number of bi-directional links (default: 16)
460
- efConstruction: 64, // Size of candidate list during construction (default: 64)
459
+ hnsw: {
460
+ m: 16, // Number of bi-directional links (default: 16)
461
+ efConstruction: 64, // Size of candidate list during construction (default: 64)
462
+ },
461
463
  },
462
464
  },
463
465
  },
@@ -178,7 +178,7 @@ await store.createSearchIndex({
178
178
  })
179
179
  ```
180
180
 
181
- The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Recreating the _same_ logical index with different `fields` still requires dropping the existing index first (`IndexAlreadyExists`).
181
+ The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Calling `createSearchIndex()` again for the _same_ logical index with different `fields` updates the existing text index definition in place. You don't need to drop it first.
182
182
 
183
183
  ### `waitForSearchIndexReady()`
184
184
 
@@ -279,18 +279,18 @@ Returns:
279
279
  interface IndexStats {
280
280
  dimension: number
281
281
  count: number
282
- metric: 'cosine' | 'euclidean' | 'dotproduct'
282
+ metric?: 'cosine' | 'euclidean' | 'dotproduct'
283
283
  }
284
284
  ```
285
285
 
286
- On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
286
+ On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `metric` is omitted when the `autoEmbed` index doesn't specify a similarity. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
287
287
 
288
288
  ### `deleteIndex()`
289
289
 
290
290
  Deletes a vector index. Behavior depends on how the index was created:
291
291
 
292
292
  - **Managed index** (created without `collectionName`): drops the entire collection and all its data.
293
- - **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
293
+ - **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. A vectorSearch or full-text index that another logical index on the same collection still references is kept for that index. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
294
294
 
295
295
  The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
296
296
 
@@ -350,7 +350,7 @@ Query results are returned in this format:
350
350
  interface QueryResult {
351
351
  id: string
352
352
  score: number
353
- metadata: Record<string, any>
353
+ metadata?: Record<string, any>
354
354
  vector?: number[] // Only included if includeVector is true
355
355
  document?: string // Source text stored with the vector, when available
356
356
  }
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
  // package.json
13
- var version = "1.24.1-alpha.1";
13
+ var version = "1.24.1";
14
14
  // src/vector/filter.ts
15
15
  /**
16
16
  * Translator for MongoDB filter queries.
@@ -46,10 +46,9 @@ var MongoDBFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
46
46
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("$not operator requires an object");
47
47
  if (this.isEmpty(value)) throw new Error("$not operator cannot be empty");
48
48
  return this.translateNode(value);
49
- } else {
50
- if (!Array.isArray(value)) throw new Error(`Value for logical operator ${operator} must be an array`);
51
- return value.map((item) => this.translateNode(item));
52
49
  }
50
+ if (!Array.isArray(value)) throw new Error(`Value for logical operator ${operator} must be an array`);
51
+ return value.map((item) => this.translateNode(item));
53
52
  }
54
53
  if (this.isBasicOperator(operator) || this.isNumericOperator(operator)) {
55
54
  if (value instanceof Date) return value.toISOString();