MongoSchema.aggregate

Start of an aggregation call. Returns a pipeline with typesafe functions for modifying the pipeline and running it at the end.

mixintemplate MongoSchema()
static
aggregate
()

Examples

auto groupResults = Book.aggregate.groupAll([
	"totalPrice": Bson([
		"$sum": Bson([
			"$multiply": Bson([Bson("$price"), Bson("$quantity")])
		])
	]),
	"averageQuantity": Bson([
		"$avg": Bson("$quantity")
	]),
	"count": Bson(["$sum": Bson(1)])
]).run;

Meta