INNER CODE UNIT · Rust
Some
fcoury/oxide · src/commands/aggregate/mod.rs:100
if let Some(last_stage) = stages.last_mut() {
for (field, value) in stage_doc.get_document("$sort").unwrap() {
let field = if last_stage.0 == "$wrap" {
format!("row_to_json(s_wrap)::jsonb->'{}'", field)
} else {
field_to_jsonb(field)
};
let asc = match value {
Bson::Int32(i) => *i > 0,
Bson::Int64(i) => *i > 0,
t => unimplemented!("Missing $sort handling for {:?}", t),
};
last_stage.1.add_order(&field, asc);
}
}
}
"$project" => match process_project(stage_doc.get_document("$project").unwrap()) {
Ok(sql) => {