@mastra/chroma 0.0.0-switch-to-core-20250424015131 → 0.0.0-vnext-inngest-20250506121901

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,15 +1,163 @@
1
1
  # @mastra/chroma
2
2
 
3
- ## 0.0.0-switch-to-core-20250424015131
3
+ ## 0.0.0-vnext-inngest-20250506121901
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [967b41c]
8
+ - Updated dependencies [3d2fb5c]
9
+ - Updated dependencies [26738f4]
10
+ - Updated dependencies [4155f47]
11
+ - Updated dependencies [7eeb2bc]
12
+ - Updated dependencies [b804723]
13
+ - Updated dependencies [8607972]
14
+ - Updated dependencies [ccef9f9]
15
+ - Updated dependencies [0097d50]
16
+ - Updated dependencies [7eeb2bc]
17
+ - Updated dependencies [17826a9]
18
+ - Updated dependencies [fba031f]
19
+ - Updated dependencies [51e6923]
20
+ - @mastra/core@0.0.0-vnext-inngest-20250506121901
21
+
22
+ ## 0.2.13-alpha.5
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [3d2fb5c]
27
+ - Updated dependencies [7eeb2bc]
28
+ - Updated dependencies [8607972]
29
+ - Updated dependencies [7eeb2bc]
30
+ - Updated dependencies [fba031f]
31
+ - @mastra/core@0.9.2-alpha.5
32
+
33
+ ## 0.2.13-alpha.4
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [ccef9f9]
38
+ - Updated dependencies [51e6923]
39
+ - @mastra/core@0.9.2-alpha.4
40
+
41
+ ## 0.2.13-alpha.3
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [967b41c]
46
+ - Updated dependencies [4155f47]
47
+ - Updated dependencies [17826a9]
48
+ - @mastra/core@0.9.2-alpha.3
49
+
50
+ ## 0.2.13-alpha.2
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [26738f4]
55
+ - @mastra/core@0.9.2-alpha.2
56
+
57
+ ## 0.2.13-alpha.1
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [b804723]
62
+ - @mastra/core@0.9.2-alpha.1
63
+
64
+ ## 0.2.13-alpha.0
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [0097d50]
69
+ - @mastra/core@0.9.2-alpha.0
70
+
71
+ ## 0.2.12
72
+
73
+ ### Patch Changes
74
+
75
+ - 5f826d9: Moved vector store specific prompts from @mastra/rag to be exported from the store that the prompt belongs to, ie @mastra/pg
76
+ - Updated dependencies [405b63d]
7
77
  - Updated dependencies [81fb7f6]
78
+ - Updated dependencies [20275d4]
79
+ - Updated dependencies [7d1892c]
80
+ - Updated dependencies [a90a082]
81
+ - Updated dependencies [2d17c73]
82
+ - Updated dependencies [61e92f5]
83
+ - Updated dependencies [35955b0]
84
+ - Updated dependencies [6262bd5]
85
+ - Updated dependencies [c1409ef]
86
+ - Updated dependencies [3e7b69d]
87
+ - Updated dependencies [e4943b8]
88
+ - Updated dependencies [11d4485]
89
+ - Updated dependencies [479f490]
90
+ - Updated dependencies [c23a81c]
91
+ - Updated dependencies [2d4001d]
92
+ - Updated dependencies [c71013a]
93
+ - Updated dependencies [1d3b1cd]
94
+ - @mastra/core@0.9.1
95
+
96
+ ## 0.2.12-alpha.8
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [2d17c73]
101
+ - @mastra/core@0.9.1-alpha.8
102
+
103
+ ## 0.2.12-alpha.7
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies [1d3b1cd]
108
+ - @mastra/core@0.9.1-alpha.7
109
+
110
+ ## 0.2.12-alpha.6
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [c23a81c]
115
+ - @mastra/core@0.9.1-alpha.6
116
+
117
+ ## 0.2.12-alpha.5
118
+
119
+ ### Patch Changes
120
+
121
+ - 5f826d9: Moved vector store specific prompts from @mastra/rag to be exported from the store that the prompt belongs to, ie @mastra/pg
122
+ - Updated dependencies [3e7b69d]
123
+ - @mastra/core@0.9.1-alpha.5
124
+
125
+ ## 0.2.12-alpha.4
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [e4943b8]
130
+ - Updated dependencies [479f490]
131
+ - @mastra/core@0.9.1-alpha.4
132
+
133
+ ## 0.2.12-alpha.3
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [6262bd5]
138
+ - @mastra/core@0.9.1-alpha.3
139
+
140
+ ## 0.2.12-alpha.2
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [405b63d]
145
+ - Updated dependencies [61e92f5]
146
+ - Updated dependencies [c71013a]
147
+ - @mastra/core@0.9.1-alpha.2
148
+
149
+ ## 0.2.12-alpha.1
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [20275d4]
8
154
  - Updated dependencies [7d1892c]
9
155
  - Updated dependencies [a90a082]
10
156
  - Updated dependencies [35955b0]
157
+ - Updated dependencies [c1409ef]
158
+ - Updated dependencies [11d4485]
11
159
  - Updated dependencies [2d4001d]
12
- - @mastra/core@0.0.0-switch-to-core-20250424015131
160
+ - @mastra/core@0.9.1-alpha.1
13
161
 
14
162
  ## 0.2.12-alpha.0
15
163
 
@@ -11,6 +11,14 @@ import type { UpsertVectorArgs } from '@mastra/core/vector';
11
11
  import type { UpsertVectorParams } from '@mastra/core/vector';
12
12
  import type { VectorFilter } from '@mastra/core/vector/filter';
13
13
 
14
+ /**
15
+ * Vector store specific prompt that details supported operators and examples.
16
+ * This prompt helps users construct valid filters for Chroma Vector.
17
+ */
18
+ declare const CHROMA_PROMPT = "When querying Chroma, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf 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.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n\nLogical Operators:\n- $and: Logical AND\n Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nRestrictions:\n- Regex patterns are not supported\n- Element operators are not supported\n- Only $and and $or logical operators are supported\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Empty arrays in $in/$nin will return no results\n- If multiple top-level fields exist, they're wrapped in $and\n- Only logical operators ($and, $or) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n Invalid: { \"$in\": [...] }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"$or\": [\n { \"inStock\": true },\n { \"preorder\": true }\n ]}\n ]\n}";
19
+ export { CHROMA_PROMPT }
20
+ export { CHROMA_PROMPT as CHROMA_PROMPT_alias_1 }
21
+
14
22
  /**
15
23
  * Translator for Chroma filter queries.
16
24
  * Maintains MongoDB-compatible syntax while ensuring proper validation
@@ -11,6 +11,14 @@ import type { UpsertVectorArgs } from '@mastra/core/vector';
11
11
  import type { UpsertVectorParams } from '@mastra/core/vector';
12
12
  import type { VectorFilter } from '@mastra/core/vector/filter';
13
13
 
14
+ /**
15
+ * Vector store specific prompt that details supported operators and examples.
16
+ * This prompt helps users construct valid filters for Chroma Vector.
17
+ */
18
+ declare const CHROMA_PROMPT = "When querying Chroma, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf 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.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n\nLogical Operators:\n- $and: Logical AND\n Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nRestrictions:\n- Regex patterns are not supported\n- Element operators are not supported\n- Only $and and $or logical operators are supported\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Empty arrays in $in/$nin will return no results\n- If multiple top-level fields exist, they're wrapped in $and\n- Only logical operators ($and, $or) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n Invalid: { \"$in\": [...] }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- Logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"$or\": [\n { \"inStock\": true },\n { \"preorder\": true }\n ]}\n ]\n}";
19
+ export { CHROMA_PROMPT }
20
+ export { CHROMA_PROMPT as CHROMA_PROMPT_alias_1 }
21
+
14
22
  /**
15
23
  * Translator for Chroma filter queries.
16
24
  * Maintains MongoDB-compatible syntax while ensuring proper validation
package/dist/index.cjs CHANGED
@@ -233,4 +233,75 @@ var ChromaVector = class extends vector.MastraVector {
233
233
  }
234
234
  };
235
235
 
236
+ // src/vector/prompt.ts
237
+ var CHROMA_PROMPT = `When querying Chroma, you can ONLY use the operators listed below. Any other operators will be rejected.
238
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
239
+ 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.
240
+
241
+ Basic Comparison Operators:
242
+ - $eq: Exact match (default when using field: value)
243
+ Example: { "category": "electronics" }
244
+ - $ne: Not equal
245
+ Example: { "category": { "$ne": "electronics" } }
246
+ - $gt: Greater than
247
+ Example: { "price": { "$gt": 100 } }
248
+ - $gte: Greater than or equal
249
+ Example: { "price": { "$gte": 100 } }
250
+ - $lt: Less than
251
+ Example: { "price": { "$lt": 100 } }
252
+ - $lte: Less than or equal
253
+ Example: { "price": { "$lte": 100 } }
254
+
255
+ Array Operators:
256
+ - $in: Match any value in array
257
+ Example: { "category": { "$in": ["electronics", "books"] } }
258
+ - $nin: Does not match any value in array
259
+ Example: { "category": { "$nin": ["electronics", "books"] } }
260
+
261
+ Logical Operators:
262
+ - $and: Logical AND
263
+ Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
264
+ - $or: Logical OR
265
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
266
+
267
+ Restrictions:
268
+ - Regex patterns are not supported
269
+ - Element operators are not supported
270
+ - Only $and and $or logical operators are supported
271
+ - Nested fields are supported using dot notation
272
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
273
+ - Empty arrays in $in/$nin will return no results
274
+ - If multiple top-level fields exist, they're wrapped in $and
275
+ - Only logical operators ($and, $or) can be used at the top level
276
+ - All other operators must be used within a field condition
277
+ Valid: { "field": { "$gt": 100 } }
278
+ Valid: { "$and": [...] }
279
+ Invalid: { "$gt": 100 }
280
+ Invalid: { "$in": [...] }
281
+ - Logical operators must contain field conditions, not direct operators
282
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
283
+ Invalid: { "$and": [{ "$gt": 100 }] }
284
+ - Logical operators ($and, $or):
285
+ - Can only be used at top level or nested within other logical operators
286
+ - Can not be used on a field level, or be nested inside a field
287
+ - Can not be used inside an operator
288
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
289
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
290
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
291
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
292
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
293
+
294
+ Example Complex Query:
295
+ {
296
+ "$and": [
297
+ { "category": { "$in": ["electronics", "computers"] } },
298
+ { "price": { "$gte": 100, "$lte": 1000 } },
299
+ { "$or": [
300
+ { "inStock": true },
301
+ { "preorder": true }
302
+ ]}
303
+ ]
304
+ }`;
305
+
306
+ exports.CHROMA_PROMPT = CHROMA_PROMPT;
236
307
  exports.ChromaVector = ChromaVector;
package/dist/index.d.cts CHANGED
@@ -1 +1,2 @@
1
+ export { CHROMA_PROMPT } from './_tsup-dts-rollup.cjs';
1
2
  export { ChromaVector } from './_tsup-dts-rollup.cjs';
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export { CHROMA_PROMPT } from './_tsup-dts-rollup.js';
1
2
  export { ChromaVector } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -231,4 +231,74 @@ var ChromaVector = class extends MastraVector {
231
231
  }
232
232
  };
233
233
 
234
- export { ChromaVector };
234
+ // src/vector/prompt.ts
235
+ var CHROMA_PROMPT = `When querying Chroma, you can ONLY use the operators listed below. Any other operators will be rejected.
236
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
237
+ 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.
238
+
239
+ Basic Comparison Operators:
240
+ - $eq: Exact match (default when using field: value)
241
+ Example: { "category": "electronics" }
242
+ - $ne: Not equal
243
+ Example: { "category": { "$ne": "electronics" } }
244
+ - $gt: Greater than
245
+ Example: { "price": { "$gt": 100 } }
246
+ - $gte: Greater than or equal
247
+ Example: { "price": { "$gte": 100 } }
248
+ - $lt: Less than
249
+ Example: { "price": { "$lt": 100 } }
250
+ - $lte: Less than or equal
251
+ Example: { "price": { "$lte": 100 } }
252
+
253
+ Array Operators:
254
+ - $in: Match any value in array
255
+ Example: { "category": { "$in": ["electronics", "books"] } }
256
+ - $nin: Does not match any value in array
257
+ Example: { "category": { "$nin": ["electronics", "books"] } }
258
+
259
+ Logical Operators:
260
+ - $and: Logical AND
261
+ Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
262
+ - $or: Logical OR
263
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
264
+
265
+ Restrictions:
266
+ - Regex patterns are not supported
267
+ - Element operators are not supported
268
+ - Only $and and $or logical operators are supported
269
+ - Nested fields are supported using dot notation
270
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
271
+ - Empty arrays in $in/$nin will return no results
272
+ - If multiple top-level fields exist, they're wrapped in $and
273
+ - Only logical operators ($and, $or) can be used at the top level
274
+ - All other operators must be used within a field condition
275
+ Valid: { "field": { "$gt": 100 } }
276
+ Valid: { "$and": [...] }
277
+ Invalid: { "$gt": 100 }
278
+ Invalid: { "$in": [...] }
279
+ - Logical operators must contain field conditions, not direct operators
280
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
281
+ Invalid: { "$and": [{ "$gt": 100 }] }
282
+ - Logical operators ($and, $or):
283
+ - Can only be used at top level or nested within other logical operators
284
+ - Can not be used on a field level, or be nested inside a field
285
+ - Can not be used inside an operator
286
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
287
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
288
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
289
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
290
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
291
+
292
+ Example Complex Query:
293
+ {
294
+ "$and": [
295
+ { "category": { "$in": ["electronics", "computers"] } },
296
+ { "price": { "$gte": 100, "$lte": 1000 } },
297
+ { "$or": [
298
+ { "inStock": true },
299
+ { "preorder": true }
300
+ ]}
301
+ ]
302
+ }`;
303
+
304
+ export { CHROMA_PROMPT, ChromaVector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/chroma",
3
- "version": "0.0.0-switch-to-core-20250424015131",
3
+ "version": "0.0.0-vnext-inngest-20250506121901",
4
4
  "description": "Chroma vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,16 +21,16 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "chromadb": "^2.2.0",
24
- "@mastra/core": "0.0.0-switch-to-core-20250424015131"
24
+ "@mastra/core": "0.0.0-vnext-inngest-20250506121901"
25
25
  },
26
26
  "devDependencies": {
27
- "@microsoft/api-extractor": "^7.52.1",
27
+ "@microsoft/api-extractor": "^7.52.5",
28
28
  "@types/node": "^20.17.27",
29
29
  "eslint": "^9.23.0",
30
30
  "tsup": "^8.4.0",
31
31
  "typescript": "^5.8.2",
32
- "vitest": "^3.0.9",
33
- "@internal/lint": "0.0.2"
32
+ "vitest": "^3.1.2",
33
+ "@internal/lint": "0.0.0-vnext-inngest-20250506121901"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './vector/index';
2
+ export { CHROMA_PROMPT } from './vector/prompt';
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Vector store specific prompt that details supported operators and examples.
3
+ * This prompt helps users construct valid filters for Chroma Vector.
4
+ */
5
+ export const CHROMA_PROMPT = `When querying Chroma, 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
+
29
+ Logical Operators:
30
+ - $and: Logical AND
31
+ Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
32
+ - $or: Logical OR
33
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
34
+
35
+ Restrictions:
36
+ - Regex patterns are not supported
37
+ - Element operators are not supported
38
+ - Only $and and $or logical operators are supported
39
+ - Nested fields are supported using dot notation
40
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
41
+ - Empty arrays in $in/$nin will return no results
42
+ - If multiple top-level fields exist, they're wrapped in $and
43
+ - Only logical operators ($and, $or) can be used at the top level
44
+ - All other operators must be used within a field condition
45
+ Valid: { "field": { "$gt": 100 } }
46
+ Valid: { "$and": [...] }
47
+ Invalid: { "$gt": 100 }
48
+ Invalid: { "$in": [...] }
49
+ - Logical operators must contain field conditions, not direct operators
50
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
51
+ Invalid: { "$and": [{ "$gt": 100 }] }
52
+ - Logical operators ($and, $or):
53
+ - Can only be used at top level or nested within other logical operators
54
+ - Can not be used on a field level, or be nested inside a field
55
+ - Can not be used inside an operator
56
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
57
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
58
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
59
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
60
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
61
+
62
+ Example Complex Query:
63
+ {
64
+ "$and": [
65
+ { "category": { "$in": ["electronics", "computers"] } },
66
+ { "price": { "$gte": 100, "$lte": 1000 } },
67
+ { "$or": [
68
+ { "inStock": true },
69
+ { "preorder": true }
70
+ ]}
71
+ ]
72
+ }`;