@mastra/mongodb 0.13.3 → 0.13.6-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.
@@ -1,97 +0,0 @@
1
- /**
2
- * Vector store specific prompt that details supported operators and examples.
3
- * This prompt helps users construct valid filters for MongoDB Vector.
4
- */
5
- export const MONGODB_PROMPT = `When querying MongoDB Vector, you can ONLY use the operators listed below. Any other operators will be rejected.
6
- Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
7
- If a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.
8
-
9
- Basic Comparison Operators:
10
- - $eq: Exact match (default when using field: value)
11
- Example: { "category": "electronics" }
12
- - $ne: Not equal
13
- Example: { "category": { "$ne": "electronics" } }
14
- - $gt: Greater than
15
- Example: { "price": { "$gt": 100 } }
16
- - $gte: Greater than or equal
17
- Example: { "price": { "$gte": 100 } }
18
- - $lt: Less than
19
- Example: { "price": { "$lt": 100 } }
20
- - $lte: Less than or equal
21
- Example: { "price": { "$lte": 100 } }
22
-
23
- Array Operators:
24
- - $in: Match any value in array
25
- Example: { "category": { "$in": ["electronics", "books"] } }
26
- - $nin: Does not match any value in array
27
- Example: { "category": { "$nin": ["electronics", "books"] } }
28
- - $all: Match all values in array
29
- Example: { "tags": { "$all": ["premium", "sale"] } }
30
- - $elemMatch: Match array elements that meet all specified conditions
31
- Example: { "items": { "$elemMatch": { "price": { "$gt": 100 } } } }
32
- - $size: Match arrays with specific length
33
- Example: { "tags": { "$size": 3 } }
34
-
35
- Logical Operators:
36
- - $and: Logical AND (can be implicit or explicit)
37
- Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
38
- Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
39
- - $or: Logical OR
40
- Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
41
- - $not: Logical NOT
42
- Example: { "$not": { "category": "electronics" } }
43
- - $nor: Logical NOR
44
- Example: { "$nor": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
45
-
46
- Element Operators:
47
- - $exists: Check if field exists
48
- Example: { "rating": { "$exists": true } }
49
- - $type: Check field type
50
- Example: { "price": { "$type": "number" } }
51
-
52
- Text Search Operators:
53
- - $text: Full text search
54
- Example: { "$text": { "$search": "gaming laptop" } }
55
- - $regex: Regular expression match
56
- Example: { "name": { "$regex": "^Gaming" } }
57
-
58
- Restrictions:
59
- - Only logical operators ($and, $or, $not, $nor) can be used at the top level
60
- - Empty arrays in array operators will return no results
61
- - Nested fields are supported using dot notation
62
- - Multiple conditions on the same field are supported
63
- - At least one key-value pair is required in filter object
64
- - Empty objects and undefined values are treated as no filter
65
- - Invalid types in comparison operators will throw errors
66
- - All non-logical operators must be used within a field condition
67
- Valid: { "field": { "$gt": 100 } }
68
- Valid: { "$and": [...] }
69
- Invalid: { "$gt": 100 }
70
- - Logical operators must contain field conditions, not direct operators
71
- Valid: { "$and": [{ "field": { "$gt": 100 } }] }
72
- Invalid: { "$and": [{ "$gt": 100 }] }
73
- - Logical operators ($and, $or, $not, $nor):
74
- - Can only be used at top level or nested within other logical operators
75
- - Can not be used on a field level, or be nested inside a field
76
- - Can not be used inside an operator
77
- - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
78
- - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
79
- - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
80
- - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
81
- - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
82
-
83
- Example Complex Query:
84
- {
85
- "$and": [
86
- { "category": { "$in": ["electronics", "computers"] } },
87
- { "price": { "$gte": 100, "$lte": 1000 } },
88
- { "tags": { "$all": ["premium", "sale"] } },
89
- { "items": { "$elemMatch": { "price": { "$gt": 50 }, "inStock": true } } },
90
- { "$text": { "$search": "gaming laptop" } },
91
- { "$or": [
92
- { "stock": { "$gt": 0 } },
93
- { "preorder": true }
94
- ]},
95
- { "$not": { "status": "discontinued" } }
96
- ]
97
- }`;
@@ -1,9 +0,0 @@
1
- {
2
- "extends": ["./tsconfig.json", "../../tsconfig.build.json"],
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*"],
8
- "exclude": ["node_modules", "**/*.test.ts", "src/**/*.mock.ts"]
9
- }
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*", "tsup.config.ts"],
4
- "exclude": ["node_modules", "**/*.test.ts"]
5
- }
package/tsup.config.ts DELETED
@@ -1,17 +0,0 @@
1
- import { generateTypes } from '@internal/types-builder';
2
- import { defineConfig } from 'tsup';
3
-
4
- export default defineConfig({
5
- entry: ['src/index.ts'],
6
- format: ['esm', 'cjs'],
7
- clean: true,
8
- dts: false,
9
- splitting: true,
10
- treeshake: {
11
- preset: 'smallest',
12
- },
13
- sourcemap: true,
14
- onSuccess: async () => {
15
- await generateTypes(process.cwd());
16
- },
17
- });
package/vitest.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'node',
6
- include: ['src/**/*.test.ts'],
7
- coverage: {
8
- reporter: ['text', 'json', 'html'],
9
- },
10
- },
11
- });