|
|
|
|
|
MongoAggregationPipeline (Function) In french: MongoPipelineAgrégation Used to retrieve documents that enter a multi-stage pipeline and are transformed into aggregated results. sPipeline is string = ...
"["+CR+...
" { ""$group"":"+CR+...
" {"+CR+...
" ""_id"": { ""state"": ""$state"", ""city"": ""$city"" },"+CR+...
" ""pop"": { ""$sum"": ""$pop"" }"+CR+...
" }"+CR+...
" },"+CR+...
" { ""$sort"": { ""pop"": 1 } },"+CR+...
" { ""$group"":"+CR+...
" {"+CR+...
" ""_id"": ""$_id.state"","+CR+...
" ""biggestCity"": { ""$last"": ""$_id.city"" },"+CR+...
" ""biggestPop"": { ""$last"": ""$pop"" },"+CR+...
" ""smallestCity"": { ""$first"": ""$_id.city"" },"+CR+...
" ""smallestPop"": { ""$first"": ""$pop"" }"+CR+...
" }"+CR+...
" },"+CR+...
" { ""$project"":"+CR+...
" {"+CR+...
" ""_id"": 0,"+CR+...
" ""state"": ""$_id"","+CR+...
" ""biggestCity"": { ""name"": ""$biggestCity"", ""pop"": ""$biggestPop"" },"+CR+...
" ""smallestCity"": { ""name"": ""$smallestCity"", ""pop"": ""$smallestPop"" }"+CR+...
" }"+CR+...
" }"+CR+...
"]"
let r = MongoAggregationPipeline(gCnx.BaseDeDonnées["db"].Collection["zipcodes"], sPipeline)
FOR EACH v OF r
Trace(VariantToJSON(v))
END
Syntax
<Result> = MongoAggregationPipeline(<Collection> , <Pipeline>)
<Result>: mongoResult variable mongoResult variable corresponding to the result. If a problem occurs, ErrorInfo is used to identify the error. <Collection>: mongoCollection variable Name of the mongoCollection variable corresponding to the MongoDB collection where the document search will be performed. <Pipeline>: Character string json(string), bson(buffer) or variant document that describes the pipeline in mongoDB format.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|