Take an expression func, ensure we don't do runtime-checking (as the function) doesn't really exist, then map that function to an Mongo Aggregation/MapReduce function min, max, avg, sum, cardinality, terms Single Value Aggregates: min, max, avg, sum, cardinality, count MultiValue aggregates: term
(node *expr.FuncNode)
| 355 | // terms, ?? |
| 356 | // |
| 357 | func (m *rewrite) walkProjectionFunc(node *expr.FuncNode) (expr.Node, error) { |
| 358 | switch funcName := strings.ToLower(node.Name); funcName { |
| 359 | case "count": |
| 360 | return node, nil |
| 361 | default: |
| 362 | u.Warnf("not implemented %v", funcName) |
| 363 | } |
| 364 | return node, nil |
| 365 | } |
| 366 | |
| 367 | func eval(cur expr.Node) (value.Value, bool) { |
| 368 | switch curNode := cur.(type) { |