In short.
Mem0's Enhanced Metadata Filtering is a guide for developers narrowing an AI agent's stored memories, but database choice can cause some conditions to be ignored silently. It documents self-hosted Memory and AsyncMemory syntax and compares five database adapters. Its most useful details concern wildcard behavior, incomplete operator support and differences between search() and get_all(). Runtime correctness, configuration validity and performance have not been assessed.
Researched and written by an AI model and checked by a second AI model. How it works
The scope is the complete documentation page at [https://docs.mem0.ai/open-source/features/metadata-filtering], supplied as selected-page.html, including its examples, compatibility table, notices and date metadata. Linked pages and underlying implementation files are excluded. No code was executed; filter enforcement, configuration acceptance, error handling and performance remain untested.
The overview
identity
Enhanced Metadata Filtering is an official Mem0 documentation page about querying attributes attached to stored memories, such as category, priority, status and user identity. The resource is a feature guide for the self-hosted Memory and AsyncMemory interfaces.
The original page is [https://docs.mem0.ai/open-source/features/metadata-filtering]. It distinguishes the self-hosted filter grammar from the hosted Mem0 Platform grammar.
assessment
The guide is useful when an application already stores memories in Mem0 and needs retrieval rules beyond a natural-language query. Its examples make simple equality filters approachable, while its adapter table exposes differences that matter when designing richer queries or changing databases.
A complete first-time installation requires information absent here, including package installation, provider configuration and credentials. The examples establish documented usage, without demonstrating successful execution.
users
Beginner developers can use the direct key-value examples to understand how a user identifier and a category narrow a memory search. Experienced developers will find the nested logic, adapter differences and silent failure warnings more consequential.
The illustrated applications include finding active project tasks, retrieving unresolved support tickets and filtering content recommendations by stored preferences. These are examples of memory retrieval rules; complete applications and user journeys are not demonstrated.
capabilities
The documented grammar includes direct equality, explicit eq and ne checks, numeric bounds with gt, gte, lt and lte, and list membership or exclusion with in and nin. Text conditions use contains for case-sensitive substring matching and icontains for case-insensitive matching.
AND, OR and NOT combine conditions into logic trees. Sibling top-level keys are implicitly ANDed, so simple combinations do not require an explicit AND wrapper. The '*' value has database-specific behavior rather than one portable meaning.
Using it
requirements
The Python examples assume an environment that can import Memory from mem0, a configured memory instance, stored metadata and a database adapter supporting the intended conditions. Useful filtering also depends on the stored fields and values matching the application's queries.
Python version requirements, complete dependency versions, hardware needs, model configuration, credentials and deployment requirements are unknown from this page. Naming a supported database does not establish support for every operator in its Mem0 adapter.
mechanism
A search supplies a natural-language query alongside a filters dictionary. Field names select stored attributes; values or operator dictionaries express conditions. Mem0 translates logical wrappers at the search() layer before passing filters to the database adapter.
The page says get_all() accepts entity and comparison filters, but does not receive the same logical-wrapper translation. Qdrant recognizes raw logical keys, whereas a logical wrapper passed to get_all() on pgvector silently matches nothing. Plain sibling conditions avoid that particular wrapper issue.
setup
The basic example imports Memory and creates m = Memory(). The configuration example separately shows Qdrant at localhost:6333 with category, priority, status and user_id listed under indexed_fields. It does not show that configuration being applied or provide index-creation results.
The page states that existing equality filters continue to work and suggests adding richer operator branches gradually. Its indexing advice is a starting point for configuration work; accepted settings and performance effects remain unassessed.
example
After creating a Memory instance, the page calls m.search("What are my preferences?", filters={"user_id": "alice", "category": "preferences"}). Both conditions must hold under the documented implicit AND behavior, so returned memories are expected to belong to Alice and carry the preferences category.
A more complex example combines work or personal categories with priority of at least 5 and exclusion of archived status. The page supplies the filter expressions and expected behavior, but no returned records or execution results.
Assessment & evidence
limitations
The compatibility table describes Mem0's database adapters. It documents comparison, list, text and nested logical support for Qdrant and pgvector. Both require list values for in and nin; malformed values produce a Qdrant client validation error or a pgvector ValueError.
Chroma supports comparison and list operators and one level of logical nesting, but contains and icontains silently fall back to equality. Pinecone supports comparison and list operators, while text operators and explicit logical trees are not implemented; its conditions are ANDed field by field.
The documented Weaviate adapter filters only user_id, agent_id and run_id using exact equality. Other keys, including metadata conditions, are silently dropped.
For '*', pgvector requires the field to exist. Qdrant and Chroma drop that field condition, allowing records without the field to qualify. Pinecone treats '*' as a literal string. Unsupported conditions may be ignored without an exception, so a successful call does not demonstrate that every clause was enforced.
reasoning
The main adoption consideration is whether the chosen adapter preserves the application's required conditions. The documented syntax offers considerable flexibility, but silent dropping or reinterpretation can change the meaning of a query. Qdrant and pgvector have the broadest documented coverage among the five adapters compared here.
The numeric examples constrain eligible metadata values; they do not demonstrate sorting results by those fields. Likewise, indexing and filter-ordering recommendations have no accompanying timings. The good_filters and avoid_filters examples use different predicates, so they do not isolate a performance benefit from ordering alone.
alternatives
For straightforward exact matches, the guide's flat sibling filters provide a simpler expression than nested logical trees. They also avoid the documented logical-wrapper problem with get_all() on pgvector.
Hosted users are directed to Memory Filters (Platform) [https://docs.mem0.ai/platform/features/v2-memory-filters]. This page states that Platform also implicitly ANDs sibling keys, excludes nin from its contract and rejects top-level keys outside a fixed allow-list with HTTP 400. The linked guide's complete behavior, costs and setup are outside this page's evidence.
evidence
The supporting source is Mem0's complete Enhanced Metadata Filtering documentation page [https://docs.mem0.ai/open-source/features/metadata-filtering]. It contains operator explanations, Python examples, an adapter compatibility table and warnings about differences between interfaces and databases.
No adapter implementation files, runtime outputs or benchmark measurements accompany the page. Its compatibility statements are documentation claims, and actual behavior for a particular installation remains unverified.
Access & freshness
costs
The page provides no prices or operating-cost estimates. Infrastructure costs, database charges and any model or embedding-provider charges are unknown.
The self-hosted and open-source descriptions do not establish a zero-cost deployment. No measured savings from filtering or indexing are supplied.
rights
The page appears in Mem0's Open Source documentation and links to its documentation source on GitHub. It does not provide a licence text or specific reuse and redistribution terms for the documentation or embedded examples.
The applicable licences and their conditions are unknown from this page alone.
freshness
The page metadata records a modification date of 2026-08-20. The supplied copy was captured on 2026-11-15.
Migration examples label earlier syntax as v0.x and enhanced syntax as v1.0.0. Those comments do not establish the current package release or pin the compatibility table to a particular implementation commit. Compatibility with any specific installed version is unknown.
actions
Identify the required operators and compare them with the documented adapter coverage before adopting complex filters. Begin with simple equality conditions, then check richer expressions against representative memories, including missing fields and values that should be excluded.
For an implementation evaluation, inspect the filters reaching the database and the metadata returned. Check search() and get_all() separately, validate list operand types, and preserve required user or agent constraints in fallback filters. Measure the same workload before and after indexing; no correctness or speed result has been established here.
