odmantic.query
Bases: Dict[str, Any]
Base object used to build queries.
All comparison and logical operators returns QueryExpression objects.
The | and & operators are supported for respectively the
or and the and logical operators.
Warning
When using those operators make sure to correctly bracket the expressions to avoid python operator precedence issues.
Source code in odmantic/query.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
Logical Operators¶
Logical AND operation between multiple QueryExpression objects.
Source code in odmantic/query.py
38 39 40 | |
Logical OR operation between multiple QueryExpression objects.
Source code in odmantic/query.py
43 44 45 | |
Logical NOR operation between multiple QueryExpression objects.
Source code in odmantic/query.py
48 49 50 | |
Comparison Operators¶
Equality comparison operator.
Source code in odmantic/query.py
69 70 71 | |
Inequality comparison operator (includes documents not containing the field).
Source code in odmantic/query.py
74 75 76 | |
Greater than (strict) comparison operator (i.e. >).
Source code in odmantic/query.py
79 80 81 | |
Greater than or equal comparison operator (i.e. >=).
Source code in odmantic/query.py
84 85 86 | |
Less than (strict) comparison operator (i.e. <).
Source code in odmantic/query.py
89 90 91 | |
Less than or equal comparison operator (i.e. <=).
Source code in odmantic/query.py
94 95 96 | |
Select instances where field is contained in sequence.
Source code in odmantic/query.py
99 100 101 | |
Select instances where field is not contained in sequence.
Source code in odmantic/query.py
104 105 106 | |
Select instances where field matches the pattern regular expression.
Source code in odmantic/query.py
109 110 111 112 113 114 115 116 117 | |
Sort helpers¶
Bases: Dict[str, Literal[-1, 1]]
Base object used to build sort queries.
Source code in odmantic/query.py
120 121 122 123 124 125 126 127 | |