neosqlite.collection.expr_evaluator.python_evaluators.array_ops module

Array and array-transform Python evaluators.

neosqlite.collection.expr_evaluator.python_evaluators.array_ops._bson_sort_key(value: Any) tuple[int, Any][source]

Return a sort key tuple that encodes BSON comparison order.

The first element is the BSON type group (0..9), the second is the value itself for same-type comparison. Unknown types fall at the end.

neosqlite.collection.expr_evaluator.python_evaluators.array_ops._bson_sort(array: list[Any]) list[Any][source]

Sort a list using MongoDB BSON comparison order.

neosqlite.collection.expr_evaluator.python_evaluators.array_ops._set_key(v: Any) Any[source]

Hashable canonical form of an element for $set* operators (#122).

neosqlite.collection.expr_evaluator.python_evaluators.array_ops._dedupe(seq: list) list[source]
neosqlite.collection.expr_evaluator.python_evaluators.array_ops._bson_min_max(array: list, is_min: bool)[source]

min/max under BSON type ordering; None if no non-null values.

class neosqlite.collection.expr_evaluator.python_evaluators.array_ops.ArrayPythonMixin[source]

Bases: BasePythonMixin

Array, set, and transform ($filter/$map/$reduce) operators.

_evaluate_array_python(operator: str, operands: list[Any], document: dict[str, Any]) Any[source]

Evaluate array operators in Python.

_evaluate_array_transform_python(operator: str, operands: Any, document: dict[str, Any]) Any[source]

Evaluate $filter, $map, $reduce operators in Python.

These operators use variable scoping: - $filter: {input: <array>, as: <var>, cond: <expr>} - $map: {input: <array>, as: <var>, in: <expr>} - $reduce: {input: <array>, initialValue: <val>, in: <expr>}