motorhead.query
    
            Field
    Queryable field with support for MongoDB operators in the form of overridden built-in operators or MongoDB-specific methods.
Source code in motorhead/query.py
                36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150  |  | 
            name
  
      property
  
    The name of the field as well as the name of the corresponding property in the MongoDB model.
            All(value)
    $all operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  list[Any]
             | 
            
               The operator's argument.  | 
            required | 
            ElemMatch(value)
    $elemMatch operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  dict[str, Any]
             | 
            
               The operator's argument.  | 
            required | 
            Exists(value)
    $exists operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  bool
             | 
            
               The operator's argument.  | 
            required | 
            In(value)
    $in operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  Any
             | 
            
               The operator's argument.  | 
            required | 
            NotIn(value)
    $nin operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  Any
             | 
            
               The operator's argument.  | 
            required | 
            Regex(value)
    $regex operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  str
             | 
            
               The regular expression.  | 
            required | 
            Size(value)
    $size operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  int
             | 
            
               The operator's argument.  | 
            required | 
            Type(value)
    $type operator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                value
             | 
            
                  str
             | 
            
               The operator's argument.  | 
            required | 
            Query
    Query implementation.
Source code in motorhead/query.py
                
            __and__(value)
    The & operator, produces a Query.
Source code in motorhead/query.py
              
            __init__(clause=None)
    Initialization.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                clause
             | 
            
                  Clause | None
             | 
            
               The default clause of the query.  | 
            
                  None
             | 
          
            __or__(value)
    The | operator, produces a Query.
Source code in motorhead/query.py
              
            clone()
    
            Queryable
    Base class for queryable models.
It expects a Pydantic BaseModel class during subclassing in its model argument and
adds a queryable Field descriptor to the subclass for each field of the Pydantic model.
Example:
from pydantic import BaseModel
class Person(BaseModel):
    name: str
    lucky_number: int
class QPerson(Queryable, model=Person):
    __slots__ = ()
It's recommended to use the Q helper to achieve the above result, so you can have
at least ORM-level type hints and autocompletion for the created queryable class.
from pydantic import BaseModel
class Person(BaseModel):
    name: str
    lucky_number: int
QPerson = Q(Person)
Source code in motorhead/query.py
                
            __init_subclass__(*, model)
    Subclass initialization.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                model
             | 
            
                  type[BaseModel]
             | 
            
               The Pydantic model the   | 
            required | 
Source code in motorhead/query.py
              
            Q(model)
    Creates a new Queryable class that can be used to construct queries for documents
with the given Pydantic model.
The created Queryable class will have a property (Field) for all properties
that were declared in the given Pydantic class. For usage examples and more details,
plase see Queryable.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                model
             | 
            
                  type[_T]
             | 
            
               The Pydantic model the   | 
            required |