mingo
Version:
MongoDB query language for in-memory objects
22 lines (21 loc) • 1.26 kB
TypeScript
import { Iterator } from "../../lazy";
import { Any, AnyObject, Options } from "../../types";
type Granularity = "E6" | "E12" | "E24" | "E48" | "E96" | "E192" | "R5" | "R10" | "R20" | "R40" | "R80" | "POWERSOF2" | "1-2-5";
interface InputExpr {
/** An expression to group documents by. */
groupBy: Any;
/** A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. */
buckets: number;
/** A document that specifies the fields to include in the output documents in addition to the _id field. */
output?: AnyObject;
/** A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. */
granularity?: Granularity;
}
/**
* Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression.
* Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets.
*
* See {@link https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/ usage}.
*/
export declare function $bucketAuto(coll: Iterator, expr: InputExpr, options: Options): Iterator;
export {};