PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV 25 feature!
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
MongoAggregationPipeline (Function)
In french: MongoPipelineAgrégation
Used to retrieve documents resulting from Map-Reduce operations in several steps.
Example
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"":  {""nom"": ""$biggestCity"",  ""pop"": ""$biggestPop"" },"+CR+...
"      ""smallestCity"": {""nom"": ""$smallestCity"", ""pop"": ""$smallestPop"" }"+CR+...
"    }"+CR+...
"  }"+CR+...
"]"
 
 
let r = MongoAggregationPipeline(gCnt..Database["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.
Minimum version required
  • Version 25
This page is also available for…
Comments
Click [Add] to post a comment