beanie/odm/operators/update/bitwise.py
raw| 1 | from abc import ABC |
| 2 | |
| 3 | from beanie.odm.operators.update import BaseUpdateOperator |
| 4 | |
| 5 | |
| 6 | class BaseUpdateBitwiseOperator(BaseUpdateOperator, ABC): ... |
| 7 | |
| 8 | |
| 9 | class Bit(BaseUpdateBitwiseOperator): |
| 10 | """ |
| 11 | `$bit` update query operator |
| 12 | |
| 13 | MongoDB doc: |
| 14 | <https://docs.mongodb.com/manual/reference/operator/update/bit/> |
| 15 | """ |
| 16 | |
| 17 | def __init__(self, expression: dict): |
| 18 | self.expression = expression |
| 19 | |
| 20 | @property |
| 21 | def query(self): |
| 22 | return {"$bit": self.expression} |