Filter by Container Tags
Container tags use exact array matching - memories must have the exact same tags in the same order.Metadata Filtering with SQL Logic
Thefilters
parameter allows filtering by metadata fields using SQL-like query structures. Since we use SQL query construction in the backend, you need to structure your filters like database queries with explicit AND/OR logic.
Why This Structure?
In SQL databases,AND
has higher precedence than OR
. Without explicit grouping, a query like:
Filter Structure Rules:
- Always wrap conditions in
AND
orOR
arrays (even single conditions) - Use
JSON.stringify()
to convert the filter object to a string - Each condition needs
key
,value
, andnegate
properties negate: false
for normal matching,negate: true
for exclusion
Simple Metadata Filter
Multiple Conditions (AND Logic)
Alternative Conditions (OR Logic)
Complex Nested Logic
Array Contains Filtering
Filter memories that contain specific values in array fields like participants, tags, or team members.Basic Array Contains
Array Contains with Exclusion
Multiple Array Contains (OR Logic)
Combined Container Tags + Metadata Filtering
Common Mistakes:
- Using bare condition objects:
{"key": "category", "value": "programming"}
- Forgetting JSON.stringify: passing objects instead of strings
- Missing negate property: always include
"negate": false
or"negate": true
Container Tags vs Metadata Filtering:
- Container tags: Exact array matching for organizational grouping
- Metadata filters: SQL-like queries on custom metadata fields with complex logic
- Both can be combined for powerful filtering capabilities