diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..3d4d6c9a3 --- /dev/null +++ b/404.html @@ -0,0 +1,1130 @@ + + + +
+ + + + + + + + + + + + + + +class Document(LazyModel, SettersInterface, InheritanceInterface,
+ FindInterface, AggregateInterface, OtherGettersInterface)
+
++ +Document Mapping class.
+Fields:
++
+- +
id
- MongoDB document ObjectID "_id" field. +Mapped to the PydanticObjectId class
@classmethod
+async def get(cls: Type["DocType"],
+ document_id: Any,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ with_children: bool = False,
+ **pymongo_kwargs) -> Optional["DocType"]
+
++ +Get document by id, returns None if document does not exist
+Arguments:
++
+- +
document_id
: PydanticObjectId - document id- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: bool - ignore cache (if it is turned on)- +
**pymongo_kwargs
: pymongo native parameters for find operationReturns:
+Union["Document", None]
+
@wrap_with_actions(EventTypes.INSERT)
+@swap_revision_after
+@save_state_after
+@validate_self_before
+async def insert(
+ *,
+ link_rule: WriteRules = WriteRules.DO_NOTHING,
+ session: Optional[ClientSession] = None,
+ skip_actions: Optional[List[Union[ActionDirections,
+ str]]] = None) -> DocType
+
++ +Insert the document (self) to the collection
+Returns:
+Document
+
async def create(session: Optional[ClientSession] = None) -> DocType
+
++ +The same as self.insert()
+Returns:
+Document
+
@classmethod
+async def insert_one(
+ cls: Type[DocType],
+ document: DocType,
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional["BulkWriter"] = None,
+ link_rule: WriteRules = WriteRules.DO_NOTHING) -> Optional[DocType]
+
++ +Insert one document to the collection
+Arguments:
++
+- +
document
: Document - document to insert- +
session
: ClientSession - pymongo session- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
link_rule
: InsertRules - hot to manage link fieldsReturns:
+DocType
+
@classmethod
+async def insert_many(cls: Type[DocType],
+ documents: Iterable[DocType],
+ session: Optional[ClientSession] = None,
+ link_rule: WriteRules = WriteRules.DO_NOTHING,
+ **pymongo_kwargs) -> InsertManyResult
+
++ +Insert many documents to the collection
+Arguments:
++
+- +
documents
: List["Document"] - documents to insert- +
session
: ClientSession - pymongo session- +
link_rule
: InsertRules - how to manage link fieldsReturns:
+InsertManyResult
+
@wrap_with_actions(EventTypes.REPLACE)
+@swap_revision_after
+@save_state_after
+@validate_self_before
+async def replace(
+ ignore_revision: bool = False,
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ link_rule: WriteRules = WriteRules.DO_NOTHING,
+ skip_actions: Optional[List[Union[ActionDirections,
+ str]]] = None) -> DocType
+
++ +Fully update the document in the database
+Arguments:
++
+- +
session
: Optional[ClientSession] - pymongo session.- +
ignore_revision
: bool - do force replace. +Used when revision based protection is turned on.- +
bulk_writer
: "BulkWriter" - Beanie bulk writerReturns:
+self
+
@wrap_with_actions(EventTypes.SAVE)
+@save_state_after
+@validate_self_before
+async def save(session: Optional[ClientSession] = None,
+ link_rule: WriteRules = WriteRules.DO_NOTHING,
+ ignore_revision: bool = False,
+ **kwargs) -> None
+
++ +Update an existing model in the database or
+insert it if it does not yet exist.
+Arguments:
++
+- +
session
: Optional[ClientSession] - pymongo session.- +
link_rule
: WriteRules - rules how to deal with links on writing- +
ignore_revision
: bool - do force save.Returns:
+None
+
@saved_state_needed
+@wrap_with_actions(EventTypes.SAVE_CHANGES)
+@validate_self_before
+async def save_changes(
+ ignore_revision: bool = False,
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ skip_actions: Optional[List[Union[ActionDirections,
+ str]]] = None) -> None
+
++ +Save changes.
+State management usage must be turned on
+Arguments:
++
+- +
ignore_revision
: bool - ignore revision id, if revision is turned on- +
bulk_writer
: "BulkWriter" - Beanie bulk writerReturns:
+None
+
@classmethod
+async def replace_many(cls: Type[DocType],
+ documents: List[DocType],
+ session: Optional[ClientSession] = None) -> None
+
++ +Replace list of documents
+Arguments:
++
+- +
documents
: List["Document"]- +
session
: Optional[ClientSession] - pymongo session.Returns:
+None
+
@wrap_with_actions(EventTypes.UPDATE)
+@save_state_after
+async def update(*args,
+ ignore_revision: bool = False,
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ skip_actions: Optional[List[Union[ActionDirections,
+ str]]] = None,
+ skip_sync: Optional[bool] = None,
+ **pymongo_kwargs) -> DocType
+
++ +Partially update the document in the database
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: ClientSession - pymongo session.- +
ignore_revision
: bool - force update. Will update even if revision id is not the same, as stored- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+None
+
@classmethod
+def update_all(cls,
+ *args: Union[dict, Mapping],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> UpdateMany
+
++ +Partially update all the documents
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: ClientSession - pymongo session.- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
**pymongo_kwargs
: pymongo native parameters for find operationReturns:
+UpdateMany query
+
def set(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ skip_sync: Optional[bool] = None,
+ **kwargs)
+
++ +Set values
+Example:
++class Sample(Document): + one: int + +await Document.find(Sample.one == 1).set({Sample.one: 100}) +
Uses Set operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any] - keys and +values to set- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writer- +
skip_sync
: bool - skip doc syncing. Available for the direct instances onlyReturns:
+self
+
def current_date(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ skip_sync: Optional[bool] = None,
+ **kwargs)
+
++ +Set current date
+Uses CurrentDate operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any]- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writer- +
skip_sync
: bool - skip doc syncing. Available for the direct instances onlyReturns:
+self
+
def inc(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ skip_sync: Optional[bool] = None,
+ **kwargs)
+
++ +Increment
+Example:
++class Sample(Document): + one: int + +await Document.find(Sample.one == 1).inc({Sample.one: 100}) +
Uses Inc operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any]- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writer- +
skip_sync
: bool - skip doc syncing. Available for the direct instances onlyReturns:
+self
+
@wrap_with_actions(EventTypes.DELETE)
+async def delete(session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ link_rule: DeleteRules = DeleteRules.DO_NOTHING,
+ skip_actions: Optional[List[Union[ActionDirections,
+ str]]] = None,
+ **pymongo_kwargs) -> Optional[DeleteResult]
+
++ +Delete the document
+Arguments:
++
+- +
session
: Optional[ClientSession] - pymongo session.- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
link_rule
: DeleteRules - rules for link fields- +
**pymongo_kwargs
: pymongo native parameters for delete operationReturns:
+Optional[DeleteResult] - pymongo DeleteResult instance.
+
@classmethod
+async def delete_all(cls,
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> Optional[DeleteResult]
+
++ +Delete all the documents
+Arguments:
++
+- +
session
: Optional[ClientSession] - pymongo session.- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
**pymongo_kwargs
: pymongo native parameters for delete operationReturns:
+Optional[DeleteResult] - pymongo DeleteResult instance.
+
@classmethod
+def use_state_management(cls) -> bool
+
++ +Is state management turned on
+Returns:
+bool
+
@classmethod
+def state_management_save_previous(cls) -> bool
+
++ +Should we save the previous state after a commit to database
+Returns:
+bool
+
@classmethod
+def state_management_replace_objects(cls) -> bool
+
++ +Should objects be replaced when using state management
+Returns:
+bool
+
def get_saved_state() -> Optional[Dict[str, Any]]
+
++ +Saved state getter. It is protected property.
+Returns:
+Optional[Dict[str, Any]] - saved state
+
def get_previous_saved_state() -> Optional[Dict[str, Any]]
+
++ +Previous state getter. It is a protected property.
+Returns:
+Optional[Dict[str, Any]] - previous state
+
@classmethod
+def get_settings(cls) -> DocumentSettings
+
++ +Get document settings, which was created on
+the initialization step
+Returns:
+DocumentSettings class
+
@classmethod
+async def inspect_collection(cls,
+ session: Optional[ClientSession] = None
+ ) -> InspectionResult
+
++ + + + + + +Check, if documents, stored in the MongoDB collection
+are compatible with the Document schema
+Returns:
+InspectionResult
+
def Indexed(typ=None, index_type=ASCENDING, **kwargs)
+
++ +If
+typ
is defined, returns a subclass oftyp
with an extra attribute +_indexed
as a tuple: +- Index 0:index_type
such aspymongo.ASCENDING
+- Index 1:kwargs
passed toIndexModel
+When instantiated the type of the result will actually betyp
.When
+typ
is not defined, returns anIndexedAnnotation
instance, to be +used as metadata inAnnotated
fields.Example:
++# Both fields would have the same behavior +class MyModel(BaseModel): + field1: Indexed(str, unique=True) + field2: Annotated[str, Indexed(unique=True)] +
class PydanticObjectId(ObjectId)
+
++ +Object Id field. Compatible with Pydantic.
+
class ExpressionField(str)
+
def __getitem__(item)
+
++ +Get sub field
+Arguments:
++
+- +
item
: name of the subfieldReturns:
+ExpressionField
+
def __getattr__(item)
+
++ +Get sub field
+Arguments:
++
+- +
item
: name of the subfieldReturns:
+ExpressionField
+
class LinkInfo(BaseModel)
+
++ +Document class
+
class Link(Generic[T])
+
@classmethod
+async def fetch_list(cls,
+ links: List[Union["Link", "DocType"]],
+ fetch_links: bool = False)
+
++ +Fetch list that contains links and documents
+Arguments:
++
+- +
links
:- +
fetch_links
:
class BackLink(Generic[T])
+
++ + + + + + +Back reference to a document
+
class FindInterface()
+
@classmethod
+def find_one(
+ cls: Type["DocType"],
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type["DocumentProjectionType"]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ with_children: bool = False,
+ **pymongo_kwargs
+) -> Union[FindOne["DocType"], FindOne["DocumentProjectionType"]]
+
++ +Find one document by criteria.
+Returns FindOne query object. +When awaited this will either return a document or None if no document exists for the search criteria.
+Arguments:
++
+- +
args
: *Mapping[str, Any] - search criteria- +
projection_model
: Optional[Type[BaseModel]] - projection model- +
session
: Optional[ClientSession] - pymongo session instance- +
ignore_cache
: bool- +
**pymongo_kwargs
: pymongo native parameters for find operation (if Document class contains links, this parameter must fit the respective parameter of the aggregate MongoDB function)Returns:
+FindOne - find query instance
+
@classmethod
+def find_many(
+ cls: Type["DocType"],
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type["DocumentProjectionType"]] = None,
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ with_children: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union[FindMany["DocType"], FindMany["DocumentProjectionType"]]
+
++ +Find many documents by criteria.
+Returns FindMany query object
+Arguments:
++
+- +
args
: *Mapping[str, Any] - search criteria- +
skip
: Optional[int] - The number of documents to omit.- +
limit
: Optional[int] - The maximum number of results to return.- +
sort
: Union[None, str, List[Tuple[str, SortDirection]]] - A key or a list of (key, direction) pairs specifying the sort order for this query.- +
projection_model
: Optional[Type[BaseModel]] - projection model- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: bool- +
lazy_parse
: bool- +
**pymongo_kwargs
: pymongo native parameters for find operation (if Document class contains links, this parameter must fit the respective parameter of the aggregate MongoDB function)Returns:
+FindMany - query instance
+
@classmethod
+def find(
+ cls: Type["DocType"],
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type["DocumentProjectionType"]] = None,
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ with_children: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union[FindMany["DocType"], FindMany["DocumentProjectionType"]]
+
++ +The same as find_many
+
@classmethod
+def find_all(
+ cls: Type["DocType"],
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ projection_model: Optional[Type["DocumentProjectionType"]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ with_children: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union[FindMany["DocType"], FindMany["DocumentProjectionType"]]
+
++ +Get all the documents
+Arguments:
++
+- +
skip
: Optional[int] - The number of documents to omit.- +
limit
: Optional[int] - The maximum number of results to return.- +
sort
: Union[None, str, List[Tuple[str, SortDirection]]] - A key or a list of (key, direction) pairs specifying the sort order for this query.- +
projection_model
: Optional[Type[BaseModel]] - projection model- +
session
: Optional[ClientSession] - pymongo session- +
**pymongo_kwargs
: pymongo native parameters for find operation (if Document class contains links, this parameter must fit the respective parameter of the aggregate MongoDB function)Returns:
+FindMany - query instance
+
@classmethod
+def all(
+ cls: Type["DocType"],
+ projection_model: Optional[Type["DocumentProjectionType"]] = None,
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ with_children: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union[FindMany["DocType"], FindMany["DocumentProjectionType"]]
+
++ +the same as find_all
+
@classmethod
+async def count(cls) -> int
+
++ +Number of documents in the collections
+The same as find_all().count()
+Returns:
+int
+
class SettersInterface()
+
@classmethod
+def set_collection(cls, collection)
+
++ +Collection setter
+
@classmethod
+def set_database(cls, database)
+
++ +Database setter
+
@classmethod
+def set_collection_name(cls, name: str)
+
++ +Collection name setter
+
class SessionMethods()
+
++ +Session methods
+
def set_session(session: Optional[ClientSession] = None)
+
++ +Set pymongo session
+Arguments:
++
+- +
session
: Optional[ClientSession] - pymongo session
class AggregateMethods()
+
++ +Aggregate methods
+
async def sum(field: Union[str, ExpressionField],
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False) -> Optional[float]
+
++ +Sum of values of the given field
+Example:
++class Sample(Document): + price: int + count: int + +sum_count = await Document.find(Sample.price <= 100).sum(Sample.count) +
Arguments:
++
+- +
field
: Union[str, ExpressionField]- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: boolReturns:
+float - sum. None if there are no items.
+
async def avg(field,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False) -> Optional[float]
+
++ +Average of values of the given field
+Example:
++class Sample(Document): + price: int + count: int + +avg_count = await Document.find(Sample.price <= 100).avg(Sample.count) +
Arguments:
++
+- +
field
: Union[str, ExpressionField]- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: boolReturns:
+Optional[float] - avg. None if there are no items.
+
async def max(field: Union[str, ExpressionField],
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False) -> Optional[float]
+
++ +Max of the values of the given field
+Example:
++class Sample(Document): + price: int + count: int + +max_count = await Document.find(Sample.price <= 100).max(Sample.count) +
Arguments:
++
+- +
field
: Union[str, ExpressionField]- +
session
: Optional[ClientSession] - pymongo sessionReturns:
+float - max. None if there are no items.
+
async def min(field: Union[str, ExpressionField],
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False) -> Optional[float]
+
++ +Min of the values of the given field
+Example:
++class Sample(Document): + price: int + count: int + +min_count = await Document.find(Sample.price <= 100).min(Sample.count) +
Arguments:
++
+- +
field
: Union[str, ExpressionField]- +
session
: Optional[ClientSession] - pymongo sessionReturns:
+float - min. None if there are no items.
+
class UpdateMethods()
+
++ +Update methods
+
def set(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **kwargs)
+
++ +Set values
+Example:
++class Sample(Document): + one: int + +await Document.find(Sample.one == 1).set({Sample.one: 100}) +
Uses Set operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any] - keys and +values to set- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writerReturns:
+self
+
def current_date(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **kwargs)
+
++ +Set current date
+Uses CurrentDate operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any]- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writerReturns:
+self
+
def inc(expression: Dict[Union[ExpressionField, str], Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **kwargs)
+
++ +Increment
+Example:
++class Sample(Document): + one: int + +await Document.find(Sample.one == 1).inc({Sample.one: 100}) +
Uses Inc operator
+Arguments:
++
+- +
expression
: Dict[Union[ExpressionField, str], Any]- +
session
: Optional[ClientSession] - pymongo session- +
bulk_writer
: Optional[BulkWriter] - bulk writerReturns:
+self
+
class AggregateInterface()
+
@classmethod
+def aggregate(
+ cls: Type[DocType],
+ aggregation_pipeline: list,
+ projection_model: Optional[Type[DocumentProjectionType]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ **pymongo_kwargs
+) -> Union[
+ AggregationQuery[Dict[str, Any]],
+ AggregationQuery[DocumentProjectionType],
+]
+
++ +Aggregate over collection.
+Returns AggregationQuery query object
+Arguments:
++
+- +
aggregation_pipeline
: list - aggregation pipeline- +
projection_model
: Type[BaseModel]- +
session
: Optional[ClientSession]- +
ignore_cache
: bool- +
**pymongo_kwargs
: pymongo native parameters for aggregate operationReturns:
+ +
class Expr(BaseFindEvaluationOperator)
+
++ ++
$type
query operatorExample:
++class Sample(Document): + one: int + two: int + +Expr({"$gt": [ "$one" , "$two" ]}) +
Will return query object like
++{"$expr": {"$gt": [ "$one" , "$two" ]}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/expr/
+
class JsonSchema(BaseFindEvaluationOperator)
+
++ ++
$jsonSchema
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/jsonSchema/
+
class Mod(BaseFindEvaluationOperator)
+
++ ++
$mod
query operatorExample:
++class Sample(Document): + one: int + +Mod(Sample.one, 4, 0) +
Will return query object like
++{ "one": { "$mod": [ 4, 0 ] } } +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/mod/
+
class RegEx(BaseFindEvaluationOperator)
+
++ ++
$regex
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/regex/
+
class Text(BaseFindEvaluationOperator)
+
++ ++
$text
query operatorExample:
++class Sample(Document): + description: Indexed(str, pymongo.TEXT) + +Text("coffee") +
Will return query object like
++{ + "$text": { + "$search": "coffee" , + "$caseSensitive": False, + "$diacriticSensitive": False + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/text/
+
def __init__(search: str,
+ language: Optional[str] = None,
+ case_sensitive: bool = False,
+ diacritic_sensitive: bool = False)
+
++ +Arguments:
++
+- +
search
: str- +
language
: Optional[str] = None- +
case_sensitive
: bool = False- +
diacritic_sensitive
: bool = False
class Where(BaseFindEvaluationOperator)
+
++ ++
$where
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/where/
+
class BitsAllClear(BaseFindBitwiseOperator)
+
++ ++
$bitsAllClear
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/bitsAllClear/
+
class BitsAllSet(BaseFindBitwiseOperator)
+
++ ++
$bitsAllSet
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/bitsAllSet/
+
class BitsAnyClear(BaseFindBitwiseOperator)
+
++ ++
$bitsAnyClear
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/bitsAnyClear/
+
class BitsAnySet(BaseFindBitwiseOperator)
+
++ ++
$bitsAnySet
query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/query/bitsAnySet/
+
class Exists(BaseFindElementOperator)
+
++ ++
$exists
query operatorExample:
++class Product(Document): + price: float + +Exists(Product.price, True) +
Will return query object like
++{"price": {"$exists": True}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/exists/
+
class Type(BaseFindElementOperator)
+
++ ++
$type
query operatorExample:
++class Product(Document): + price: float + +Type(Product.price, "decimal") +
Will return query object like
++{"price": {"$type": "decimal"}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/type/
+
class GeoIntersects(BaseFindGeospatialOperator)
+
++ ++
$geoIntersects
query operatorExample:
++class GeoObject(BaseModel): + type: str = "Point" + coordinates: Tuple[float, float] + +class Place(Document): + geo: GeoObject + + class Collection: + name = "places" + indexes = [ + [("geo", pymongo.GEOSPHERE)], # GEO index + ] + +GeoIntersects(Place.geo, "Polygon", [[0,0], [1,1], [3,3]]) +
Will return query object like
++{ + "geo": { + "$geoIntersects": { + "$geometry": { + "type": "Polygon", + "coordinates": [[0,0], [1,1], [3,3]], + } + } + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/geoIntersects/
+
class GeoWithin(BaseFindGeospatialOperator)
+
++ ++
$geoWithin
query operatorExample:
++class GeoObject(BaseModel): + type: str = "Point" + coordinates: Tuple[float, float] + +class Place(Document): + geo: GeoObject + + class Collection: + name = "places" + indexes = [ + [("geo", pymongo.GEOSPHERE)], # GEO index + ] + +GeoWithin(Place.geo, "Polygon", [[0,0], [1,1], [3,3]]) +
Will return query object like
++{ + "geo": { + "$geoWithin": { + "$geometry": { + "type": "Polygon", + "coordinates": [[0,0], [1,1], [3,3]], + } + } + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/geoWithin/
+
class Box(BaseFindGeospatialOperator)
+
++ ++
$box
query operatorExample:
++class GeoObject(BaseModel): + type: str = "Point" + coordinates: Tuple[float, float] + +class Place(Document): + geo: GeoObject + + class Collection: + name = "places" + indexes = [ + [("geo", pymongo.GEOSPHERE)], # GEO index + ] + +Box(Place.geo, lower_left=[10,12], upper_right=[15,20]) +
Will return query object like
++{ + "geo": { + "$geoWithin": { + "$box": [[10, 12], [15, 20]] + } + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/box/
+
class Near(BaseFindGeospatialOperator)
+
++ ++
$near
query operatorExample:
++class GeoObject(BaseModel): + type: str = "Point" + coordinates: Tuple[float, float] + +class Place(Document): + geo: GeoObject + + class Collection: + name = "places" + indexes = [ + [("geo", pymongo.GEOSPHERE)], # GEO index + ] + +Near(Place.geo, 1.2345, 2.3456, min_distance=500) +
Will return query object like
++{ + "geo": { + "$near": { + "$geometry": { + "type": "Point", + "coordinates": [1.2345, 2.3456], + }, + "$maxDistance": 500, + } + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/near/
+
class NearSphere(Near)
+
++ ++
$nearSphere
query operatorExample:
++class GeoObject(BaseModel): + type: str = "Point" + coordinates: Tuple[float, float] + +class Place(Document): + geo: GeoObject + + class Collection: + name = "places" + indexes = [ + [("geo", pymongo.GEOSPHERE)], # GEO index + ] + +NearSphere(Place.geo, 1.2345, 2.3456, min_distance=500) +
Will return query object like
++{ + "geo": { + "$nearSphere": { + "$geometry": { + "type": "Point", + "coordinates": [1.2345, 2.3456], + }, + "$maxDistance": 500, + } + } +} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/nearSphere/
+
class All(BaseFindArrayOperator)
+
++ ++
$all
array query operatorExample:
++class Sample(Document): + results: List[int] + +All(Sample.results, [80, 85]) +
Will return query object like
++{"results": {"$all": [80, 85]}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/all
+
class ElemMatch(BaseFindArrayOperator)
+
++ ++
$elemMatch
array query operatorExample:
++class Sample(Document): + results: List[int] + +ElemMatch(Sample.results, {"$in": [80, 85]}) +
Will return query object like
++{"results": {"$elemMatch": {"$in": [80, 85]}}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/elemMatch/
+
class Size(BaseFindArrayOperator)
+
++ ++
$size
array query operatorExample:
++class Sample(Document): + results: List[int] + +Size(Sample.results, 2) +
Will return query object like
++{"results": {"$size": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/size/
+
class Or(LogicalOperatorForListOfExpressions)
+
++ ++
$or
query operatorExample:
++class Product(Document): + price: float + category: str + +Or(Product.price<10, Product.category=="Sweets") +
Will return query object like
++{"$or": [{"price": {"$lt": 10}}, {"category": "Sweets"}]} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/or/
+
class And(LogicalOperatorForListOfExpressions)
+
++ ++
$and
query operatorExample:
++class Product(Document): + price: float + category: str + +And(Product.price<10, Product.category=="Sweets") +
Will return query object like
++{"$and": [{"price": {"$lt": 10}}, {"category": "Sweets"}]} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/and/
+
class Nor(BaseFindLogicalOperator)
+
++ ++
$nor
query operatorExample:
++class Product(Document): + price: float + category: str + +Nor(Product.price<10, Product.category=="Sweets") +
Will return query object like
++{"$nor": [{"price": {"$lt": 10}}, {"category": "Sweets"}]} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/nor/
+
class Not(BaseFindLogicalOperator)
+
++ ++
$not
query operatorExample:
++class Product(Document): + price: float + category: str + +Not(Product.price<10) +
Will return query object like
++{"$not": {"price": {"$lt": 10}}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/not/
+
class Eq(BaseFindComparisonOperator)
+
++ ++
equal
query operatorExample:
++class Product(Document): + price: float + +Eq(Product.price, 2) +
Will return query object like
++{"price": 2} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/eq/
+
class GT(BaseFindComparisonOperator)
+
++ ++
$gt
query operatorExample:
++class Product(Document): + price: float + +GT(Product.price, 2) +
Will return query object like
++{"price": {"$gt": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/gt/
+
class GTE(BaseFindComparisonOperator)
+
++ ++
$gte
query operatorExample:
++class Product(Document): + price: float + +GTE(Product.price, 2) +
Will return query object like
++{"price": {"$gte": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/gte/
+
class In(BaseFindComparisonOperator)
+
++ ++
$in
query operatorExample:
++class Product(Document): + price: float + +In(Product.price, [2, 3, 4]) +
Will return query object like
++{"price": {"$in": [2, 3, 4]}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/in/
+
class NotIn(BaseFindComparisonOperator)
+
++ ++
$nin
query operatorExample:
++class Product(Document): + price: float + +NotIn(Product.price, [2, 3, 4]) +
Will return query object like
++{"price": {"$nin": [2, 3, 4]}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/nin/
+
class LT(BaseFindComparisonOperator)
+
++ ++
$lt
query operatorExample:
++class Product(Document): + price: float + +LT(Product.price, 2) +
Will return query object like
++{"price": {"$lt": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/lt/
+
class LTE(BaseFindComparisonOperator)
+
++ ++
$lte
query operatorExample:
++class Product(Document): + price: float + +LTE(Product.price, 2) +
Will return query object like
++{"price": {"$lte": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/lte/
+
class NE(BaseFindComparisonOperator)
+
++ + + + + + ++
$ne
query operatorExample:
++class Product(Document): + price: float + +NE(Product.price, 2) +
Will return query object like
++{"price": {"$ne": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/query/ne/
+
class Set(BaseUpdateGeneralOperator)
+
++ ++
$set
update query operatorExample:
++class Sample(Document): + one: int + +Set({Sample.one: 2}) +
Will return query object like
++{"$set": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/set/
+
class SetRevisionId()
+
++ ++
$set
update query operatorExample:
++class Sample(Document): + one: int + +Set({Sample.one: 2}) +
Will return query object like
++{"$set": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/set/
+
class CurrentDate(BaseUpdateGeneralOperator)
+
++ ++
$currentDate
update query operatorExample:
++class Sample(Document): + ts: datetime + +CurrentDate({Sample.ts: True}) +
Will return query object like
++{"$currentDate": {"ts": True}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/currentDate/
+
class Inc(BaseUpdateGeneralOperator)
+
++ ++
$inc
update query operatorExample:
++class Sample(Document): + one: int + +Inc({Sample.one: 2}) +
Will return query object like
++{"$inc": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/inc/
+
class Min(BaseUpdateGeneralOperator)
+
++ ++
$min
update query operatorExample:
++class Sample(Document): + one: int + +Min({Sample.one: 2}) +
Will return query object like
++{"$min": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/min/
+
class Max(BaseUpdateGeneralOperator)
+
++ ++
$max
update query operatorExample:
++class Sample(Document): + one: int + +Max({Sample.one: 2}) +
Will return query object like
++{"$max": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/max/
+
class Mul(BaseUpdateGeneralOperator)
+
++ ++
$mul
update query operatorExample:
++class Sample(Document): + one: int + +Mul({Sample.one: 2}) +
Will return query object like
++{"$mul": {"one": 2}} +
MongoDB doc: + https://docs.mongodb.com/manual/reference/operator/update/mul/
+
class Rename(BaseUpdateGeneralOperator)
+
++ ++
$rename
update query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/update/rename/
+
class SetOnInsert(BaseUpdateGeneralOperator)
+
++ ++
$setOnInsert
update query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/update/setOnInsert/
+
class Unset(BaseUpdateGeneralOperator)
+
++ ++
$unset
update query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/update/unset/
+
class Bit(BaseUpdateBitwiseOperator)
+
++ ++
$bit
update query operatorMongoDB doc: +https://docs.mongodb.com/manual/reference/operator/update/bit/
+
class AddToSet(BaseUpdateArrayOperator)
+
++ ++
$addToSet
update array query operatorExample:
++class Sample(Document): + results: List[int] + +AddToSet({Sample.results: 2}) +
Will return query object like
++{"$addToSet": {"results": 2}} +
MongoDB docs: + https://docs.mongodb.com/manual/reference/operator/update/addToSet/
+
class Pop(BaseUpdateArrayOperator)
+
++ ++
$pop
update array query operatorExample:
++class Sample(Document): + results: List[int] + +Pop({Sample.results: 2}) +
Will return query object like
++{"$pop": {"results": -1}} +
MongoDB docs: + https://docs.mongodb.com/manual/reference/operator/update/pop/
+
class Pull(BaseUpdateArrayOperator)
+
++ ++
$pull
update array query operatorExample:
++class Sample(Document): + results: List[int] + +Pull(In(Sample.result: [1,2,3,4,5]) +
Will return query object like
++{"$pull": { "results": { $in: [1,2,3,4,5] }}} +
MongoDB docs: + https://docs.mongodb.com/manual/reference/operator/update/pull/
+
class Push(BaseUpdateArrayOperator)
+
++ ++
$push
update array query operatorExample:
++class Sample(Document): + results: List[int] + +Push({Sample.results: 1}) +
Will return query object like
++{"$push": { "results": 1}} +
MongoDB docs: + https://docs.mongodb.com/manual/reference/operator/update/push/
+
class PullAll(BaseUpdateArrayOperator)
+
++ + + + + + ++
$pullAll
update array query operatorExample:
++class Sample(Document): + results: List[int] + +PullAll({ Sample.results: [ 0, 5 ] }) +
Will return query object like
++{"$pullAll": { "results": [ 0, 5 ] }} +
MongoDB docs: + https://docs.mongodb.com/manual/reference/operator/update/pullAll/
+
class BaseCursorQuery(Generic[CursorResultType])
+
++ +BaseCursorQuery class. Wrapper over AsyncIOMotorCursor, +which parse result with model
+
async def to_list(length: Optional[int] = None) -> List[CursorResultType]
+
++ +Get list of documents
+Arguments:
++
+- +
length
: Optional[int] - length of the listReturns:
+Union[List[BaseModel], List[Dict[str, Any]]]
+
class FindQuery(Generic[FindQueryResultType], UpdateMethods, SessionMethods,
+ CloneInterface)
+
++ +Find Query base class
+
def get_filter_query() -> Mapping[str, Any]
+
++ +Returns: MongoDB filter query
+
def delete(session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> Union[DeleteOne, DeleteMany]
+
++ +Provide search criteria to the Delete query
+Arguments:
++
+- +
session
: Optional[ClientSession]Returns:
+Union[DeleteOne, DeleteMany]
+
def project(projection_model)
+
++ +Apply projection parameter
+Arguments:
++
+- +
projection_model
: Optional[Type[BaseModel]] - projection modelReturns:
+self
+
async def count() -> int
+
++ +Number of found documents
+Returns:
+int
+
async def exists() -> bool
+
++ +If find query will return anything
+Returns:
+bool
+
class FindMany(FindQuery[FindQueryResultType],
+ BaseCursorQuery[FindQueryResultType], AggregateMethods)
+
++ +Find Many query class
+
def find_many(
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type[FindQueryProjectionType]] = None,
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union["FindMany[FindQueryResultType]",
+ "FindMany[FindQueryProjectionType]"]
+
++ +Find many documents by criteria
+Arguments:
++
+- +
args
: *Mapping[str, Any] - search criteria- +
skip
: Optional[int] - The number of documents to omit.- +
limit
: Optional[int] - The maximum number of results to return.- +
sort
: Union[None, str, List[Tuple[str, SortDirection]]] - A key +or a list of (key, direction) pairs specifying the sort order +for this query.- +
projection_model
: Optional[Type[BaseModel]] - projection model- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: bool- +
**pymongo_kwargs
: pymongo native parameters for find operation (if Document class contains links, this parameter must fit the respective parameter of the aggregate MongoDB function)Returns:
+FindMany - query instance
+
def project(
+ projection_model: Optional[Type[FindQueryProjectionType]]
+) -> Union["FindMany[FindQueryResultType]",
+ "FindMany[FindQueryProjectionType]"]
+
++ +Apply projection parameter
+Arguments:
++
+- +
projection_model
: Optional[Type[BaseModel]] - projection modelReturns:
+self
+
def find(
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type[FindQueryProjectionType]] = None,
+ skip: Optional[int] = None,
+ limit: Optional[int] = None,
+ sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ lazy_parse: bool = False,
+ **pymongo_kwargs
+) -> Union["FindMany[FindQueryResultType]",
+ "FindMany[FindQueryProjectionType]"]
+
++ +The same as
+find_many(...)
def sort(
+ *args: Optional[Union[str, Tuple[str, SortDirection],
+ List[Tuple[str, SortDirection]]]]
+) -> "FindMany[FindQueryResultType]"
+
++ +Add sort parameters
+Arguments:
++
+- +
args
: Union[str, Tuple[str, SortDirection], +List[Tuple[str, SortDirection]]] - A key or a tuple (key, direction) +or a list of (key, direction) pairs specifying +the sort order for this query.Returns:
+self
+
def skip(n: Optional[int]) -> "FindMany[FindQueryResultType]"
+
++ +Set skip parameter
+Arguments:
++
+- +
n
: intReturns:
+self
+
def limit(n: Optional[int]) -> "FindMany[FindQueryResultType]"
+
++ +Set limit parameter
+Arguments:
++
+- +
n
: int
def update(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs)
+
++ +Create Update with modifications query
+and provide search criteria there
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: Optional[BulkWriter]Returns:
+UpdateMany query
+
def upsert(*args: Mapping[str, Any],
+ on_insert: "DocType",
+ session: Optional[ClientSession] = None,
+ **pymongo_kwargs)
+
++ +Create Update with modifications query
+and provide search criteria there
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply.- +
on_insert
: DocType - document to insert if there is no matched +document in the collection- +
session
: Optional[ClientSession]Returns:
+UpdateMany query
+
def update_many(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> UpdateMany
+
++ +Provide search criteria to the
+UpdateMany query
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply.- +
session
: Optional[ClientSession]Returns:
+UpdateMany query
+
def delete_many(session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> DeleteMany
+
++ +Provide search criteria to the DeleteMany query
+Arguments:
++
+- +
session
:Returns:
+DeleteMany query
+
def aggregate(
+ aggregation_pipeline: List[Any],
+ projection_model: Optional[Type[FindQueryProjectionType]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ **pymongo_kwargs
+) -> Union[
+ AggregationQuery[Dict[str, Any]],
+ AggregationQuery[FindQueryProjectionType],
+]
+
++ +Provide search criteria to the AggregationQuery
+Arguments:
++
+- +
aggregation_pipeline
: list - aggregation pipeline. MongoDB doc: +https://docs.mongodb.com/manual/core/aggregation-pipeline/- +
projection_model
: Type[BaseModel] - Projection Model- +
session
: Optional[ClientSession] - PyMongo session- +
ignore_cache
: boolReturns:
+ +
async def first_or_none() -> Optional[FindQueryResultType]
+
++ +Returns the first found element or None if no elements were found
+
async def count() -> int
+
++ +Number of found documents
+Returns:
+int
+
class FindOne(FindQuery[FindQueryResultType])
+
++ +Find One query class
+
def project(
+ projection_model: Optional[Type[FindQueryProjectionType]] = None
+) -> Union["FindOne[FindQueryResultType]", "FindOne[FindQueryProjectionType]"]
+
++ +Apply projection parameter
+Arguments:
++
+- +
projection_model
: Optional[Type[BaseModel]] - projection modelReturns:
+self
+
def find_one(
+ *args: Union[Mapping[str, Any], bool],
+ projection_model: Optional[Type[FindQueryProjectionType]] = None,
+ session: Optional[ClientSession] = None,
+ ignore_cache: bool = False,
+ fetch_links: bool = False,
+ **pymongo_kwargs
+) -> Union["FindOne[FindQueryResultType]", "FindOne[FindQueryProjectionType]"]
+
++ +Find one document by criteria
+Arguments:
++
+- +
args
: *Mapping[str, Any] - search criteria- +
projection_model
: Optional[Type[BaseModel]] - projection model- +
session
: Optional[ClientSession] - pymongo session- +
ignore_cache
: bool- +
**pymongo_kwargs
: pymongo native parameters for find operation (if Document class contains links, this parameter must fit the respective parameter of the aggregate MongoDB function)Returns:
+FindOne - query instance
+
def update(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs)
+
++ +Create Update with modifications query
+and provide search criteria there
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: Optional[BulkWriter]- +
response_type
: Optional[UpdateResponse]Returns:
+UpdateMany query
+
def upsert(*args: Mapping[str, Any],
+ on_insert: "DocType",
+ session: Optional[ClientSession] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs)
+
++ +Create Update with modifications query
+and provide search criteria there
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply.- +
on_insert
: DocType - document to insert if there is no matched +document in the collection- +
session
: Optional[ClientSession]- +
response_type
: Optional[UpdateResponse]Returns:
+UpdateMany query
+
def update_one(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs) -> UpdateOne
+
++ +Create UpdateOne query using modifications and
+provide search criteria there
+Arguments:
++
+- +
args
: *Mapping[str,Any] - the modifications to apply- +
session
: Optional[ClientSession] - PyMongo sessions- +
response_type
: Optional[UpdateResponse]Returns:
+UpdateOne query
+
def delete_one(session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> DeleteOne
+
++ +Provide search criteria to the DeleteOne query
+Arguments:
++
+- +
session
: Optional[ClientSession] - PyMongo sessionsReturns:
+DeleteOne query
+
async def replace_one(
+ document: "DocType",
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None) -> Optional[UpdateResult]
+
++ +Replace found document by provided
+Arguments:
++
+- +
document
: Document - document, which will replace the found one- +
session
: Optional[ClientSession] - PyMongo session- +
bulk_writer
: Optional[BulkWriter] - Beanie bulk writerReturns:
+UpdateResult
+
def __await__() -> Generator[Coroutine, Any, Optional[FindQueryResultType]]
+
++ +Run the query
+Returns:
+BaseModel
+
async def count() -> int
+
++ +Count the number of documents matching the query
+Returns:
+int
+
class DeleteQuery(SessionMethods, CloneInterface)
+
++ +Deletion Query
+
class DeleteMany(DeleteQuery)
+
def __await__() -> Generator[DeleteResult, None, Optional[DeleteResult]]
+
++ +Run the query +
+
class DeleteOne(DeleteQuery)
+
def __await__() -> Generator[DeleteResult, None, Optional[DeleteResult]]
+
++ +Run the query +
+
class AggregationQuery(Generic[AggregationProjectionType],
+ BaseCursorQuery[AggregationProjectionType],
+ SessionMethods, CloneInterface)
+
++ +Aggregation Query
+
class UpdateResponse(str, Enum)
+
++ +PyMongo update result
+
++ +Original document
+
++ +Updated document
+
class UpdateQuery(UpdateMethods, SessionMethods, CloneInterface)
+
++ +Update Query base class
+
class UpdateMany(UpdateQuery)
+
++ +Update Many query class
+
def update(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs) -> "UpdateQuery"
+
++ +Provide modifications to the update query.
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: Optional[BulkWriter]- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def upsert(*args: Mapping[str, Any],
+ on_insert: "DocType",
+ session: Optional[ClientSession] = None,
+ **pymongo_kwargs) -> "UpdateQuery"
+
++ +Provide modifications to the upsert query.
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
on_insert
: DocType - document to insert if there is no matched +document in the collection- +
session
: Optional[ClientSession]- +
**pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def update_many(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ **pymongo_kwargs)
+
++ +Provide modifications to the update query
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def __await__() -> Generator[Any, None, Union[UpdateResult, InsertOneResult,
+ Optional["DocType"]]]
+
++ +Run the query +
+
class UpdateOne(UpdateQuery)
+
++ +Update One query class
+
def update(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs) -> "UpdateQuery"
+
++ +Provide modifications to the update query.
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: Optional[BulkWriter]- +
response_type
: UpdateResponse- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def upsert(*args: Mapping[str, Any],
+ on_insert: "DocType",
+ session: Optional[ClientSession] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs) -> "UpdateQuery"
+
++ +Provide modifications to the upsert query.
+Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
on_insert
: DocType - document to insert if there is no matched +document in the collection- +
session
: Optional[ClientSession]- +
response_type
: Optional[UpdateResponse]- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def update_one(*args: Mapping[str, Any],
+ session: Optional[ClientSession] = None,
+ bulk_writer: Optional[BulkWriter] = None,
+ response_type: Optional[UpdateResponse] = None,
+ **pymongo_kwargs)
+
++ +Provide modifications to the update query. The same as
+update()
Arguments:
++
+- +
args
: *Union[dict, Mapping] - the modifications to apply.- +
session
: Optional[ClientSession]- +
bulk_writer
: "BulkWriter" - Beanie bulk writer- +
response_type
: Optional[UpdateResponse]- +
pymongo_kwargs
: pymongo native parameters for update operationReturns:
+UpdateMany query
+
def __await__() -> Generator[Any, None, Union[UpdateResult, InsertOneResult,
+ Optional["DocType"]]]
+
++ + + + + + +Run the query +
+
{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var $a=/["'&<>]/;Un.exports=Ra;function Ra(e){var t=""+e,r=$a.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i