@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.
- package/CHANGELOG.md +27 -0
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +19 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +19 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +19 -6
- package/.turbo/turbo-build.log +0 -4
- package/docker-compose.yaml +0 -30
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -4
- package/src/storage/MongoDBConnector.ts +0 -93
- package/src/storage/connectors/MongoDBConnector.ts +0 -93
- package/src/storage/connectors/base.ts +0 -7
- package/src/storage/domains/legacy-evals/index.ts +0 -193
- package/src/storage/domains/memory/index.ts +0 -786
- package/src/storage/domains/operations/index.ts +0 -155
- package/src/storage/domains/scores/index.ts +0 -389
- package/src/storage/domains/traces/index.ts +0 -142
- package/src/storage/domains/utils.ts +0 -43
- package/src/storage/domains/workflows/index.ts +0 -196
- package/src/storage/index.test.ts +0 -62
- package/src/storage/index.ts +0 -406
- package/src/storage/types.ts +0 -14
- package/src/vector/filter.test.ts +0 -420
- package/src/vector/filter.ts +0 -143
- package/src/vector/index.test.ts +0 -651
- package/src/vector/index.ts +0 -656
- package/src/vector/prompt.ts +0 -97
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.ts +0 -11
package/src/vector/prompt.ts
DELETED
|
@@ -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
|
-
}`;
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
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
|
-
});
|