neosqlite.collection.temporary_table_aggregation.operators_advanced module

class neosqlite.collection.temporary_table_aggregation.operators_advanced.OperatorsAdvancedMixin[source]

Bases: OperatorsBaseMixin

_process_densify_stage(create_temp, current_table, densify_spec)[source]

Process $densify stage - fills in missing values in a sequence.

MongoDB syntax: {

$densify: {

field: <field_name>, range: {

step: <number>, bounds: [<lower>, <upper>]

}, partitionBy: <expression> // optional

}

}

_process_facet_stage(create_temp, current_table, facet_spec)[source]

Process $facet stage - processes multiple sub-pipelines and combines results.

MongoDB syntax: {

$facet: {

<output_field1>: [<pipeline stages>], <output_field2>: [<pipeline stages>], …

}

}

This method: 1. Extracts input documents from the current temp table 2. For each sub-pipeline, executes it using normal aggregation (Tier 1/2/3) 3. Combines all results into a single document with facet fields 4. Returns a temp table containing that combined result

_process_union_with_stage(create_temp, current_table, union_spec)[source]

Process $unionWith stage - combines documents from another collection.

MongoDB syntax: {

$unionWith: {

coll: <collection_name>, pipeline: [<pipeline stages>] // optional

}

}

_process_merge_stage(create_temp, current_table, merge_spec)[source]

Process $merge stage - writes results to a collection.

MongoDB syntax: {

$merge: {

into: <collection_name>, on: <field>, // optional whenMatched: <action>, // optional whenNotMatched: <action> // optional

}

}

_process_redact_stage(create_temp, current_table, redact_spec)[source]

Process $redact stage - field-level redaction based on conditions.

MongoDB syntax: {

$redact: {
$cond: {

if: <condition>, then: <level>, else: <level>

}

}

}

Levels: - $$DESCEND: Include the field and process sub-fields - $$PRUNE: Exclude the field - $$KEEP: Include the field as-is

_process_set_window_fields_stage(create_temp: Callable[[dict[str, Any], str, list[Any]], str], current_table: str, spec: dict[str, Any]) str[source]

Process $setWindowFields stage.

_map_window_operator_to_sql(op_name: str, op_val: Any) tuple[str | None, str, list[Any]][source]

Map MongoDB window operator to SQL function and operand.

_build_window_frame_sql(window_spec: dict[str, Any] | None) str[source]

Build SQL window frame clause (ROWS BETWEEN …).

_process_graph_lookup_stage(create_temp: Callable[[dict[str, Any], str, list[Any]], str], current_table: str, spec: dict[str, Any]) str[source]

Process $graphLookup stage.

_process_fill_stage(create_temp: Callable[[dict[str, Any], str, list[Any]], str], current_table: str, spec: dict[str, Any]) str[source]

Process $fill stage.