@mastra/qdrant 0.2.11-alpha.4 → 0.2.11-alpha.6

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,23 +1,23 @@
1
1
 
2
- > @mastra/qdrant@0.2.11-alpha.4 build /home/runner/work/mastra/mastra/stores/qdrant
2
+ > @mastra/qdrant@0.2.11-alpha.6 build /home/runner/work/mastra/mastra/stores/qdrant
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 7968ms
9
+ TSC ⚡️ Build success in 8519ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/qdrant/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/qdrant/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 9971ms
16
+ DTS ⚡️ Build success in 12022ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 13.14 KB
21
- ESM ⚡️ Build success in 864ms
22
- CJS dist/index.cjs 13.17 KB
23
- CJS ⚡️ Build success in 874ms
20
+ ESM dist/index.js 16.58 KB
21
+ ESM ⚡️ Build success in 1004ms
22
+ CJS dist/index.cjs 16.64 KB
23
+ CJS ⚡️ Build success in 1004ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @mastra/qdrant
2
2
 
3
+ ## 0.2.11-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c23a81c]
8
+ - @mastra/core@0.9.1-alpha.6
9
+
10
+ ## 0.2.11-alpha.5
11
+
12
+ ### Patch Changes
13
+
14
+ - 5f826d9: Moved vector store specific prompts from @mastra/rag to be exported from the store that the prompt belongs to, ie @mastra/pg
15
+ - Updated dependencies [3e7b69d]
16
+ - @mastra/core@0.9.1-alpha.5
17
+
3
18
  ## 0.2.11-alpha.4
4
19
 
5
20
  ### Patch Changes
@@ -10,6 +10,14 @@ import type { QueryVectorParams } from '@mastra/core/vector';
10
10
  import type { UpsertVectorParams } from '@mastra/core/vector';
11
11
  import type { VectorFilter } from '@mastra/core/vector/filter';
12
12
 
13
+ /**
14
+ * Vector store specific prompt that details supported operators and examples.
15
+ * This prompt helps users construct valid filters for Qdrant Vector.
16
+ */
17
+ declare const QDRANT_PROMPT = "When querying Qdrant, 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 (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n- $not: Logical NOT\n Example: { \"$not\": { \"category\": \"electronics\" } }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n- $match: Match text using full-text search\n Example: { \"description\": { \"$match\": \"gaming laptop\" } }\n- $null: Check if field is null\n Example: { \"rating\": { \"$null\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and, $or, and $not logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\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, $not):\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 { \"description\": { \"$match\": \"gaming laptop\" } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": { \"$null\": false } }\n ]},\n { \"$not\": { \"status\": \"discontinued\" } }\n ]\n}";
18
+ export { QDRANT_PROMPT }
19
+ export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
20
+
13
21
  /**
14
22
  * Translates MongoDB-style filters to Qdrant compatible filters.
15
23
  *
@@ -10,6 +10,14 @@ import type { QueryVectorParams } from '@mastra/core/vector';
10
10
  import type { UpsertVectorParams } from '@mastra/core/vector';
11
11
  import type { VectorFilter } from '@mastra/core/vector/filter';
12
12
 
13
+ /**
14
+ * Vector store specific prompt that details supported operators and examples.
15
+ * This prompt helps users construct valid filters for Qdrant Vector.
16
+ */
17
+ declare const QDRANT_PROMPT = "When querying Qdrant, 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 (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n- $not: Logical NOT\n Example: { \"$not\": { \"category\": \"electronics\" } }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n- $match: Match text using full-text search\n Example: { \"description\": { \"$match\": \"gaming laptop\" } }\n- $null: Check if field is null\n Example: { \"rating\": { \"$null\": true } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and, $or, and $not logical operators are supported at the top level\n- Empty arrays in $in/$nin will return no results\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- At least one key-value pair is required in filter object\n- Empty objects and undefined values are treated as no filter\n- Invalid types in comparison operators will throw errors\n- All non-logical operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\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, $not):\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 { \"description\": { \"$match\": \"gaming laptop\" } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": { \"$null\": false } }\n ]},\n { \"$not\": { \"status\": \"discontinued\" } }\n ]\n}";
18
+ export { QDRANT_PROMPT }
19
+ export { QDRANT_PROMPT as QDRANT_PROMPT_alias_1 }
20
+
13
21
  /**
14
22
  * Translates MongoDB-style filters to Qdrant compatible filters.
15
23
  *
package/dist/index.cjs CHANGED
@@ -417,4 +417,88 @@ var QdrantVector = class extends vector.MastraVector {
417
417
  }
418
418
  };
419
419
 
420
+ // src/vector/prompt.ts
421
+ var QDRANT_PROMPT = `When querying Qdrant, you can ONLY use the operators listed below. Any other operators will be rejected.
422
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
423
+ 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.
424
+
425
+ Basic Comparison Operators:
426
+ - $eq: Exact match (default when using field: value)
427
+ Example: { "category": "electronics" }
428
+ - $ne: Not equal
429
+ Example: { "category": { "$ne": "electronics" } }
430
+ - $gt: Greater than
431
+ Example: { "price": { "$gt": 100 } }
432
+ - $gte: Greater than or equal
433
+ Example: { "price": { "$gte": 100 } }
434
+ - $lt: Less than
435
+ Example: { "price": { "$lt": 100 } }
436
+ - $lte: Less than or equal
437
+ Example: { "price": { "$lte": 100 } }
438
+
439
+ Array Operators:
440
+ - $in: Match any value in array
441
+ Example: { "category": { "$in": ["electronics", "books"] } }
442
+ - $nin: Does not match any value in array
443
+ Example: { "category": { "$nin": ["electronics", "books"] } }
444
+
445
+ Logical Operators:
446
+ - $and: Logical AND (can be implicit or explicit)
447
+ Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
448
+ Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
449
+ - $or: Logical OR
450
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
451
+ - $not: Logical NOT
452
+ Example: { "$not": { "category": "electronics" } }
453
+
454
+ Element Operators:
455
+ - $exists: Check if field exists
456
+ Example: { "rating": { "$exists": true } }
457
+ - $match: Match text using full-text search
458
+ Example: { "description": { "$match": "gaming laptop" } }
459
+ - $null: Check if field is null
460
+ Example: { "rating": { "$null": true } }
461
+
462
+ Restrictions:
463
+ - Regex patterns are not supported
464
+ - Only $and, $or, and $not logical operators are supported at the top level
465
+ - Empty arrays in $in/$nin will return no results
466
+ - Nested fields are supported using dot notation
467
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
468
+ - At least one key-value pair is required in filter object
469
+ - Empty objects and undefined values are treated as no filter
470
+ - Invalid types in comparison operators will throw errors
471
+ - All non-logical operators must be used within a field condition
472
+ Valid: { "field": { "$gt": 100 } }
473
+ Valid: { "$and": [...] }
474
+ Invalid: { "$gt": 100 }
475
+ - Logical operators must contain field conditions, not direct operators
476
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
477
+ Invalid: { "$and": [{ "$gt": 100 }] }
478
+ - Logical operators ($and, $or, $not):
479
+ - Can only be used at top level or nested within other logical operators
480
+ - Can not be used on a field level, or be nested inside a field
481
+ - Can not be used inside an operator
482
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
483
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
484
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
485
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
486
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
487
+
488
+ Example Complex Query:
489
+ {
490
+ "$and": [
491
+ { "category": { "$in": ["electronics", "computers"] } },
492
+ { "price": { "$gte": 100, "$lte": 1000 } },
493
+ { "description": { "$match": "gaming laptop" } },
494
+ { "rating": { "$exists": true, "$gt": 4 } },
495
+ { "$or": [
496
+ { "stock": { "$gt": 0 } },
497
+ { "preorder": { "$null": false } }
498
+ ]},
499
+ { "$not": { "status": "discontinued" } }
500
+ ]
501
+ }`;
502
+
503
+ exports.QDRANT_PROMPT = QDRANT_PROMPT;
420
504
  exports.QdrantVector = QdrantVector;
package/dist/index.d.cts CHANGED
@@ -1 +1,2 @@
1
+ export { QDRANT_PROMPT } from './_tsup-dts-rollup.cjs';
1
2
  export { QdrantVector } from './_tsup-dts-rollup.cjs';
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export { QDRANT_PROMPT } from './_tsup-dts-rollup.js';
1
2
  export { QdrantVector } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -415,4 +415,87 @@ var QdrantVector = class extends MastraVector {
415
415
  }
416
416
  };
417
417
 
418
- export { QdrantVector };
418
+ // src/vector/prompt.ts
419
+ var QDRANT_PROMPT = `When querying Qdrant, you can ONLY use the operators listed below. Any other operators will be rejected.
420
+ Important: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.
421
+ 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.
422
+
423
+ Basic Comparison Operators:
424
+ - $eq: Exact match (default when using field: value)
425
+ Example: { "category": "electronics" }
426
+ - $ne: Not equal
427
+ Example: { "category": { "$ne": "electronics" } }
428
+ - $gt: Greater than
429
+ Example: { "price": { "$gt": 100 } }
430
+ - $gte: Greater than or equal
431
+ Example: { "price": { "$gte": 100 } }
432
+ - $lt: Less than
433
+ Example: { "price": { "$lt": 100 } }
434
+ - $lte: Less than or equal
435
+ Example: { "price": { "$lte": 100 } }
436
+
437
+ Array Operators:
438
+ - $in: Match any value in array
439
+ Example: { "category": { "$in": ["electronics", "books"] } }
440
+ - $nin: Does not match any value in array
441
+ Example: { "category": { "$nin": ["electronics", "books"] } }
442
+
443
+ Logical Operators:
444
+ - $and: Logical AND (can be implicit or explicit)
445
+ Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
446
+ Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
447
+ - $or: Logical OR
448
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
449
+ - $not: Logical NOT
450
+ Example: { "$not": { "category": "electronics" } }
451
+
452
+ Element Operators:
453
+ - $exists: Check if field exists
454
+ Example: { "rating": { "$exists": true } }
455
+ - $match: Match text using full-text search
456
+ Example: { "description": { "$match": "gaming laptop" } }
457
+ - $null: Check if field is null
458
+ Example: { "rating": { "$null": true } }
459
+
460
+ Restrictions:
461
+ - Regex patterns are not supported
462
+ - Only $and, $or, and $not logical operators are supported at the top level
463
+ - Empty arrays in $in/$nin will return no results
464
+ - Nested fields are supported using dot notation
465
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
466
+ - At least one key-value pair is required in filter object
467
+ - Empty objects and undefined values are treated as no filter
468
+ - Invalid types in comparison operators will throw errors
469
+ - All non-logical operators must be used within a field condition
470
+ Valid: { "field": { "$gt": 100 } }
471
+ Valid: { "$and": [...] }
472
+ Invalid: { "$gt": 100 }
473
+ - Logical operators must contain field conditions, not direct operators
474
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
475
+ Invalid: { "$and": [{ "$gt": 100 }] }
476
+ - Logical operators ($and, $or, $not):
477
+ - Can only be used at top level or nested within other logical operators
478
+ - Can not be used on a field level, or be nested inside a field
479
+ - Can not be used inside an operator
480
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
481
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
482
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
483
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
484
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
485
+
486
+ Example Complex Query:
487
+ {
488
+ "$and": [
489
+ { "category": { "$in": ["electronics", "computers"] } },
490
+ { "price": { "$gte": 100, "$lte": 1000 } },
491
+ { "description": { "$match": "gaming laptop" } },
492
+ { "rating": { "$exists": true, "$gt": 4 } },
493
+ { "$or": [
494
+ { "stock": { "$gt": 0 } },
495
+ { "preorder": { "$null": false } }
496
+ ]},
497
+ { "$not": { "status": "discontinued" } }
498
+ ]
499
+ }`;
500
+
501
+ export { QDRANT_PROMPT, QdrantVector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/qdrant",
3
- "version": "0.2.11-alpha.4",
3
+ "version": "0.2.11-alpha.6",
4
4
  "description": "Qdrant vector store provider for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@qdrant/js-client-rest": "^1.13.0",
24
- "@mastra/core": "^0.9.1-alpha.4"
24
+ "@mastra/core": "^0.9.1-alpha.6"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@microsoft/api-extractor": "^7.52.5",
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './vector';
2
+ export { QDRANT_PROMPT } from './vector/prompt';
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Vector store specific prompt that details supported operators and examples.
3
+ * This prompt helps users construct valid filters for Qdrant Vector.
4
+ */
5
+ export const QDRANT_PROMPT = `When querying Qdrant, 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 (can be implicit or explicit)
31
+ Implicit Example: { "price": { "$gt": 100 }, "category": "electronics" }
32
+ Explicit Example: { "$and": [{ "price": { "$gt": 100 } }, { "category": "electronics" }] }
33
+ - $or: Logical OR
34
+ Example: { "$or": [{ "price": { "$lt": 50 } }, { "category": "books" }] }
35
+ - $not: Logical NOT
36
+ Example: { "$not": { "category": "electronics" } }
37
+
38
+ Element Operators:
39
+ - $exists: Check if field exists
40
+ Example: { "rating": { "$exists": true } }
41
+ - $match: Match text using full-text search
42
+ Example: { "description": { "$match": "gaming laptop" } }
43
+ - $null: Check if field is null
44
+ Example: { "rating": { "$null": true } }
45
+
46
+ Restrictions:
47
+ - Regex patterns are not supported
48
+ - Only $and, $or, and $not logical operators are supported at the top level
49
+ - Empty arrays in $in/$nin will return no results
50
+ - Nested fields are supported using dot notation
51
+ - Multiple conditions on the same field are supported with both implicit and explicit $and
52
+ - At least one key-value pair is required in filter object
53
+ - Empty objects and undefined values are treated as no filter
54
+ - Invalid types in comparison operators will throw errors
55
+ - All non-logical operators must be used within a field condition
56
+ Valid: { "field": { "$gt": 100 } }
57
+ Valid: { "$and": [...] }
58
+ Invalid: { "$gt": 100 }
59
+ - Logical operators must contain field conditions, not direct operators
60
+ Valid: { "$and": [{ "field": { "$gt": 100 } }] }
61
+ Invalid: { "$and": [{ "$gt": 100 }] }
62
+ - Logical operators ($and, $or, $not):
63
+ - Can only be used at top level or nested within other logical operators
64
+ - Can not be used on a field level, or be nested inside a field
65
+ - Can not be used inside an operator
66
+ - Valid: { "$and": [{ "field": { "$gt": 100 } }] }
67
+ - Valid: { "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }
68
+ - Invalid: { "field": { "$and": [{ "$gt": 100 }] } }
69
+ - Invalid: { "field": { "$or": [{ "$gt": 100 }] } }
70
+ - Invalid: { "field": { "$gt": { "$and": [{...}] } } }
71
+
72
+ Example Complex Query:
73
+ {
74
+ "$and": [
75
+ { "category": { "$in": ["electronics", "computers"] } },
76
+ { "price": { "$gte": 100, "$lte": 1000 } },
77
+ { "description": { "$match": "gaming laptop" } },
78
+ { "rating": { "$exists": true, "$gt": 4 } },
79
+ { "$or": [
80
+ { "stock": { "$gt": 0 } },
81
+ { "preorder": { "$null": false } }
82
+ ]},
83
+ { "$not": { "status": "discontinued" } }
84
+ ]
85
+ }`;