|
|
|
|
MongoAggregationPipeline (Función) Permite recuperar documentos que pasan por una operación de agregación en múltiples etapas y se transforman en resultados calculados. 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
Sintaxis
<Result> = MongoAggregationPipeline(<Collection> , <Pipeline>)
<Result>: Variable de tipo mongoResult Variable de tipo mongoResult que corresponde al resultado. Si se produce un problema, la función ErrorInfo permite identificar el error. <Collection>: Variable de tipo mongoCollection Nombre de la variable de tipo mongoCollection que corresponde a la colección MongoDB en la que se realizará la búsqueda de documentos. <Pipeline>: Cadena de caracteres Documento en formato json(string), bson(buffer) o variant que describe el pipeline (también conocido como "tubería") en formato mongoDB.
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|