{"id":22387664,"url":"https://github.com/mikedev75015/mongodb-pipeline-builder","last_synced_at":"2025-07-20T06:06:34.630Z","repository":{"id":44876542,"uuid":"347301511","full_name":"MikeDev75015/mongodb-pipeline-builder","owner":"MikeDev75015","description":"mongodb-pipeline-builder is a pipeline builder for the db.collection.aggregate method and db.aggregate method. It will simplify pipelines by making them more readable and much easier to edit. It also allows you to test your pipelines on a dataset in order to verify them. Pipeline stages appear in an array. Documents pass through the stages in sequence.","archived":false,"fork":false,"pushed_at":"2025-02-08T19:29:41.000Z","size":2305,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T16:18:58.923Z","etag":null,"topics":["aggregations","mongodb","mongodb-pipeline","mongoose"],"latest_commit_sha":null,"homepage":"https://mikedev75015.github.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeDev75015.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-13T07:18:09.000Z","updated_at":"2025-02-08T19:29:44.000Z","dependencies_parsed_at":"2024-09-07T01:16:49.726Z","dependency_job_id":"2e7d6fa0-f910-44e1-88f5-6de625ea12c0","html_url":"https://github.com/MikeDev75015/mongodb-pipeline-builder","commit_stats":null,"previous_names":[],"tags_count":122,"template":false,"template_full_name":null,"purl":"pkg:github/MikeDev75015/mongodb-pipeline-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeDev75015%2Fmongodb-pipeline-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeDev75015%2Fmongodb-pipeline-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeDev75015%2Fmongodb-pipeline-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeDev75015%2Fmongodb-pipeline-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeDev75015","download_url":"https://codeload.github.com/MikeDev75015/mongodb-pipeline-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeDev75015%2Fmongodb-pipeline-builder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266076097,"owners_count":23872732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aggregations","mongodb","mongodb-pipeline","mongoose"],"created_at":"2024-12-05T02:10:22.163Z","updated_at":"2025-07-20T06:06:34.593Z","avatar_url":"https://github.com/MikeDev75015.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"++\u003cdiv style=\"text-align: center; width: 100%;\"\u003e\n\n\u003cdiv style=\"display: inline-block\"\u003e\n\n[![NPM version](https://img.shields.io/npm/v/mongodb-pipeline-builder.svg)](https://www.npmjs.com/package/mongodb-pipeline-builder)\n![NPM](https://img.shields.io/npm/l/mongodb-pipeline-builder?registry_uri=https%3A%2F%2Fregistry.npmjs.com)\n![npm](https://img.shields.io/npm/dw/mongodb-pipeline-builder)\n\u003c/div\u003e\n\n\u003cdiv style=\"display: inline-block\"\u003e\n\n![GitHub branch checks state](https://img.shields.io/github/checks-status/MikeDev75015/mongodb-pipeline-builder/main)\n[![CircleCI](https://circleci.com/gh/MikeDev75015/mongodb-pipeline-builder.svg?style=shield)](https://app.circleci.com/pipelines/github/MikeDev75015/mongodb-pipeline-builder)\n![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/MikeDev75015_mongodb-pipeline-builder?server=https%3A%2F%2Fsonarcloud.io)\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv style=\"text-align: center; width: 100%;\"\u003e\n\u003cdiv style=\"display: inline-block\"\u003e\n\n![Sonar Tests](https://img.shields.io/sonar/tests/MikeDev75015_mongodb-pipeline-builder?server=https%3A%2F%2Fsonarcloud.io)\n![Sonar Coverage](https://img.shields.io/sonar/coverage/MikeDev75015_mongodb-pipeline-builder?server=https%3A%2F%2Fsonarcloud.io)\n\u003cimg src=\"https://mikedev75015.github.io/mongodb-pipeline-builder/images/coverage-badge-documentation.svg\" alt=\"documentation-badge\"\u003e\n\u003c/div\u003e\n\n\u003cdiv style=\"display: inline-block\"\u003e\n\n![GitHub top language](https://img.shields.io/github/languages/top/MikeDev75015/mongodb-pipeline-builder)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=MikeDev75015_mongodb-pipeline-builder\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=MikeDev75015_mongodb-pipeline-builder)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=MikeDev75015_mongodb-pipeline-builder\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=MikeDev75015_mongodb-pipeline-builder)\n\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cdiv style=\"text-align: center; width: 100%;\"\u003e\n\u003cdiv style=\"display: inline-block\"\u003e\n\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/MikeDev75015/mongodb-pipeline-builder)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/w/MikeDev75015/mongodb-pipeline-builder)\n![GitHub last commit (branch)](https://img.shields.io/github/last-commit/MikeDev75015/mongodb-pipeline-builder/main)\n\u003c/div\u003e\n\n\u003cdiv style=\"display: inline-block\"\u003e\n\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=MikeDev75015_mongodb-pipeline-builder\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=MikeDev75015_mongodb-pipeline-builder)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=MikeDev75015_mongodb-pipeline-builder\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=MikeDev75015_mongodb-pipeline-builder)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=MikeDev75015_mongodb-pipeline-builder\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=MikeDev75015_mongodb-pipeline-builder)\n\u003c/div\u003e\n\u003c/div\u003e\n\n---\n\n\u003cdiv style=\"text-align: center; width: 100%;\"\u003e\n\n[-\u003e Technical documentation \u003c-](https://mikedev75015.github.io/mongodb-pipeline-builder)\n\n\n\n# mongodb-pipeline-builder\n\n\u003c/div\u003e\n\n\n\u003cp style=\"text-align: justify; width: 100%;font-size: 15px;\"\u003e\n\n**mongodb-pipeline-builder** is a pipeline builder for the [db.collection.aggregate](https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/), the [db.aggregate](https://www.mongodb.com/docs/v7.0/reference/method/db.aggregate/) and the mongoose [Model.aggregate](https://mongoosejs.com/docs/api/aggregate.html#Aggregate()) methods.\n\n- Simplify pipelines by making them more readable\n- Pipelines are easier to edit. \n- Pipeline stages appear in an array. \n- Sequential stages for documents\n\nAll stages except the Out, Merge, GeoNear, ChangeStream, ChangeStreamSplitLargeEvent and Paging stages can appear multiple times in a pipeline.\n\n\u003c/p\u003e\n\n---\n\n## npm package \u003cimg src=\"https://pbs.twimg.com/media/EDoWJbUXYAArclg.png\" width=\"24\" height=\"24\" /\u003e\n\n`npm i -S mongodb-pipeline-builder`\n\n\n---\n\n\n### **News and Breaking changes** between **v3** and **v4**\n\n#### **PipelineBuilder:**\n * Renaming `getPipeline()` with `build()`\n * Added new stages: `ChangeStream`, `ChangeStreamSplitLargeEvent`, `Densify`, `Documents`, `Fill`, `ListLocalSessions`, `ListSampledQueries`, `ListSearchIndexes`, `SearchMeta`, `SetWindowFields` and `ShardedDataDistribution`.\n * Added the possibility to insert stages without validation with new `Insert` stage.\n * Checking for non-duplicable stages.\n\n#### **Helpers:**\n * Replacing the `Payload` suffix with `Helper` suffix\n * Prefixed with the name of the pipeline stage where they should be used\n\n#### **Operators:**\n * Prefixed with the **$** symbol\n * Rename `MapOperator` to `$Map`\n\n\n#### **GetResult:**\n * To be used if no Paging stage is set\n * Removing GetDocs method arguments\n * Added new GetElement method to the response object\n\n#### **GetPagingResult:**\n * To be used exclusively with Paging stage.\n\n\n*Welcome generics! `GetResult\u003cType\u003e` and `GetPagingResult\u003cType\u003e` now offer the ability to type responses.*\n\n---\n\n## Usage:\n\n\n### Using `require()`\n\n```typescript\nconst PipelineBuilder = require(\"mongodb-pipeline-builder\").PipelineBuilder;\nconst { LookupEqualityHelper, ProjectOnlyHelper, Field } = require('mongodb-pipeline-builder/helpers');\nconst { $LessThanEqual, $ArrayElementAt, $Equal, $Expression } = require('mongodb-pipeline-builder/operators');\n```\n\n### Using `import`\n\n\n```typescript\nimport { PipelineBuilder } from 'mongodb-pipeline-builder';\nimport { LookupEqualityHelper, ProjectOnlyHelper, Field } from 'mongodb-pipeline-builder/helpers';\nimport { $LessThanEqual, $ArrayElementAt, $Equal, $Expression } from 'mongodb-pipeline-builder/operators';\n```\n\n---\n\n## Pagination example\n\n\n```typescript\nconst myNewPipeline = new PipelineBuilder( 'myPagination', { debug: true } )\n    .Match( $Expression( $LessThanEqual( '$id', 20 ) ) )\n    .Project( ProjectOnlyHelper( 'name', 'weight' ) )\n    .Paging( 5, 3 ) // 5 per page, page 3\n    .build();\n```\n\n*is equivalent to*\n\n\n```typescript\nconst myNewPipeline = [ {\n    $facet: {\n        docs: [\n            { $match: { $expr: { $lte: [\"$id\", 20] } } },\n            { $project: { _id: 0, name: 1, weight: 1 } },\n            { $skip: 10 },\n            { $limit: 5 }\n        ],\n        count: [\n            { $match: { $expr: { $lte: [\"$id\", 20] } } },\n            { $count: \"totalElements\" }\n        ]\n    }\n} ];\n```\n\n---\n\n## No pagination example\n\n```typescript\nconst myNewPipeline = new PipelineBuilder( 'user-skills' )\n    .Match( $Expression( $Equal( '$id', 123456 ) ) )\n    .Lookup( LookupEqualityHelper( 'profiles', 'profile', 'id', 'profileId' ) )\n    .Project( ProjectOnlyHelper( 'firstname', 'lastname', 'email' ) )\n    .AddFields(\n        Field( 'skills', $ArrayElementAt( '$profile.skills', 0 ) ),\n        Field( 'availability', $ArrayElementAt( '$profile.availability', 0 ) )\n    )\n    .Unset( 'profile' )\n    .build();\n```\n\n*is equivalent to*\n\n```typescript\nconst myNewPipeline = [\n    { $match: { $expr: { $eq: [\"$id\", 123456] } } },\n    { $lookup: { from: \"profiles\", as: \"profile\", localField: \"id\", foreignField: \"profileId\" } },\n    { $project: { _id: 0, firstname: 1, lastname: 1, email: 1 } },\n    { $addFields: {\n        skills: { $arrayElemAt: [\"$profile.skills\", 0] },\n        availability: { $arrayElemAt: [\"$profile.availability\", 0] }\n    } },\n    { $unset: \"profile\" }\n];\n```\n\n___\n\n#  GetResult method (No pagination)\n\n```typescript\nGetResult\u003cT\u003e(): Promise\u003cGetResultResponse\u003cT\u003e\u003e\n```\n\n\u003cp style=\"font-size: 15px;\"\u003e\n\n`GetResult\u003cT\u003e()` is an **asynchronous** method that provides a very easy way to use aggregation responses.\n\n\u003cp\u003e\n\n\n\u003cp style=\"font-size: 15px;\"\u003e\n\nThis method returns a `GetResultResponse` object that contains 3 methods:\u003cbr\u003e\n\n- `GetDocs(): T[]` to get all the documents that match the request.\n- `GetElement(index: number | 'last'): T` to get a particular document by its index.\n- `GetCount(): number` to get the total number of documents found.\n\n\u003c/p\u003e\n\n\n```typescript\nconst result = await GetResult\u003cDocType\u003e( target, pipeline ); \nresult.GetDocs(); // () =\u003e DocType[]\nresult.GetElement(index | 'last'); // () =\u003e DocType | undefined\nresult.GetCount(); // () =\u003e number\n```\n\n*$Or*\n```typescript\nGetResult\u003cDocType\u003e( target, pipeline ).then( result =\u003e {\n    result.GetDocs(); // () =\u003e DocType[]\n    result.GetElement(index | 'last'); // () =\u003e DocType | undefined\n    result.GetCount(); // () =\u003e number\n} );\n```\n\n### `GetElement(index: number | 'last')` method possibilities:\n\n\u003cp style=\"font-size: 15px;\"\u003e\n\n- A particular document can be retrieved by specifying its index.\n- To get the last document, simply provide the string `'last'`. \n- If the specified index is greater than the index of the last document, `GetElement()` will return undefined.\n\u003c/p\u003e\n\n```typescript\n// GetDocs() -\u003e [document1, document2, document3, ..., document51]\nresult.GetElement(2); // will return document to index 2, document3\nresult.GetElement('last'); // will return the last document, document51\nresult.GetElement(99); // will return undefined\n```\n\n---\n\n#  GetPagingResult method (Pagination)\n\n```typescript\nGetPagingResult\u003cT\u003e(): Promise\u003cGetPagingResultResponse\u003cT\u003e\u003e\n```\n\n\u003cp style=\"font-size: 15px;\"\u003e\n\n`GetPagingResult\u003cT\u003e()` is an **asynchronous** method that provides a very easy way to use aggregation responses when **Paging** stage is used.\n\n\u003cp\u003e\n\n\n\u003cp style=\"font-size: 15px;\"\u003e\n\nThis method returns a `GetPagingResultResponse` object that contains three methods:\n- `GetDocs()` to get the documents found.\n- `GetCount()` to get the total number of documents found.\n- `GetTotalPageNumber()` to get the total number of pages.\n\n\u003c/p\u003e\n\n\n```typescript\nconst result = await GetPagingResult\u003cDocType\u003e(target, pipeline);\nresult.GetDocs(); // () =\u003e DocType[]\nresult.GetCount(); // () =\u003e number\nresult.GetTotalPageNumber(); // () =\u003e number\n```\n\n*$Or*\n```typescript\nGetPagingResult\u003cDocType\u003e(target, pipeline).then( result =\u003e {\n    result.GetDocs(); // () =\u003e DocType[]\n    result.GetCount(); // () =\u003e number\n    result.GetTotalPageNumber(); // () =\u003e number\n} );\n```\n\n\n___\n\n\n[=\u003e Try the lib on NPM RunKit with the require method \u003c=](https://npm.runkit.com/mongodb-pipeline-builder)\n\n---\n\n`// builder = new PipelineBuilder('example');`\n\n## CUSTOM STAGES\n\n### Paging(elementsPerPage, page)\n\n  *The Paging stage automatically adds 3 native stages used to paginate documents ($skip, $limit and $count).\n  \u003cbr\u003ePage is optional and defaults to 1.*\n\n```typescript\nbuilder.Paging(5, 2).build();\n\n// pipeline\n[\n  {\n    $facet: {\n      docs: [ { '$skip': 5 }, { '$limit': 5 } ],\n      count: [ { '$count': 'totalElements' } ]\n    }\n  }\n]\n```\n\n### Insert(stage)\n\n  *The Insert stage allows you to insert a stage without validation.\n  \u003cbr\u003eUsefully when you need to insert a stage that is not yet implemented\n  or when the value fails validation but for some reason you want to keep it.*\n\n```typescript\nbuilder.Insert({ '$myCustomStage': { myField: 'myValue' } }).build();\n\n// pipeline\n[ { $myCustomStage: { myField: 'myValue' } } ]\n```\n\n\n## [MONGODB STAGES](https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/)\n\n### [AddFields](https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/)(...values)\n#### Helper: `Field(name, value)`\n```typescript\nbuilder.AddFields(\n  Field('foo', 'value1'),\n  Field('bar', 'value2'),\n).build();\n\n// pipeline\n[ { $addFields: { foo: 'value1', bar: 'value2' } } ]\n```\n\n### [Bucket](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/)(value)\n#### Helper: `BucketHelper(groupBy, boundaries, optional)`\n```typescript\nbuilder.Bucket(BucketHelper('$age', [6, 13, 18])).build();\n\n// pipeline\n[ { $bucket: { groupBy: '$age', boundaries: [ 6, 13, 18 ] } } ]\n```\n\n### [BucketAuto](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/)(value)\n#### Helper: `BucketAutoHelper(groupBy, buckets, optional)`\n```typescript\nbuilder.BucketAuto(BucketAutoHelper('$age', 5)).build();\n\n// pipeline\n[ { $bucketAuto: { groupBy: '$age', buckets: 5 } } ]\n```\n\n### [ChangeStream](https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/)(value)\n#### Helper: `ChangeStreamHelper(optional)`\n```typescript\nbuilder.ChangeStream(ChangeStreamHelper()).build();\n\n// pipeline\n[ { $changeStream: {} } ]\n```\n\n### [ChangeStreamSplitLargeEvent](https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/)()\n```typescript\nbuilder.ChangeStreamSplitLargeEvent().build();\n\n// pipeline\n[ { $changeStreamSplitLargeEvent: {} } ]\n```\n\n### [CollStats](https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/)(value)\n#### Helper: `CollStatsHelper(optional)`\n```typescript\nbuilder.CollStats(CollStatsHelper()).build();\n\n// pipeline\n[ { $collStats: {} } ]\n```\n\n### [Count](https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/)(value)\n```typescript\nbuilder.Count('counter').build();\n\n// pipeline\n[ { $count: 'counter' } ]\n```\n\n### [CurrentOp](https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/)(value)\n#### Helper: `CurrentOpHelper(optional)`\n```typescript\nbuilder.CurrentOp(CurrentOpHelper()).build();\n\n// pipeline\n[ { $currentOp: {} } ]\n```\n\n### [Densify](https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/)(value)\n#### Helper: `DensifyHelper(field, range, optional)`\n```typescript\nbuilder.Densify(\n    DensifyHelper(\n      'altitude',\n      { bounds: 'full', step: 200 },\n      { partitionByFields: [ 'variety' ] }\n    ),\n).build();\n\n// pipeline\n[\n  {\n    $densify: {\n      field: 'altitude',\n      range: { bounds: 'full', step: 200 }\n      partitionByFields: [ 'variety' ],\n    }\n  }\n]\n```\n\n### [Documents](https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/)(...values)\n```typescript\nbuilder.Documents({ docId: 1 }, { docId: 2 }, { docId: 3 }).build();\n\n// pipeline\n[ { $documents: [ { docId: 1 }, { docId: 2 }, { docId: 3 } ] } ]\n```\n\n### [Facet](https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/)(...values)\n#### Helper: `Field(name, pipeline)`\n```typescript\nbuilder.Facet(\n  Field('pipeline1', [{ $match: { tag: 'first' }}]),\n  Field('pipeline2', [{ $match: { tag: 'second' }}]),\n  Field('pipeline3', [{ $match: { tag: 'third' }}]),\n).build();\n\n// pipeline\n[\n  {\n    $facet: {\n      pipeline1: [ { '$match': { tag: 'first' } } ],\n      pipeline2: [ { '$match': { tag: 'second' } } ],\n      pipeline3: [ { '$match': { tag: 'third' } } ]\n    }\n  }\n]\n```\n\n### [Fill](https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/)(value)\n#### Helper: `FillHelper(output, optional)`\n```typescript\nbuilder.Fill(\n  FillHelper({\n    bootsSold: { value: 0 },\n    sandalsSold: { value: 0 },\n    sneakersSold: { value: 0 },\n  }),\n).build();\n\n// pipeline\n[\n  {\n    $fill: {\n      output: {\n        bootsSold: { value: 0 },\n        sandalsSold: { value: 0 },\n        sneakersSold: { value: 0 }\n      }\n    }\n  }\n]\n```\n\n### [GeoNear](https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/)(value)\n#### Helper: `GeoNearHelper(near, distanceField, optional)`\n```typescript\nbuilder.GeoNear(\n  GeoNearHelper({ type: \"Point\", coordinates: [ -73.99279 , 40.719296 ] }, 'calculated')\n).build();\n\n// pipeline\n[\n  {\n    $geoNear: {\n      near: { type: 'Point', coordinates: [ -73.99279, 40.719296 ] },\n      distanceField: 'calculated'\n    }\n  }\n]\n```\n\n### [GraphLookup](https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/)(value)\n```typescript\nbuilder.GraphLookup({\n  from: 'employees', startWith: '$reportsTo', connectFromField: 'reportsTo', connectToField: 'name', as: 'reportingHierarchy',\n}).build();\n\n// pipeline\n[\n  {\n    $graphLookup: {\n      from: 'employees',\n      startWith: '$reportsTo',\n      connectFromField: 'reportsTo',\n      connectToField: 'name',\n      as: 'reportingHierarchy'\n    }\n  }\n]\n```\n\n### [Group](https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/)(value)\n```typescript\nbuilder.Group({ _id: null, count: { $count: { } } }).build();\n\n// pipeline\n[\n  { $group: { _id: null, count: { '$count': {} } } }\n]\n```\n\n### [IndexStats](https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/)()\n```typescript\nbuilder.IndexStats().build();\n\n// pipeline\n[ { $indexStats: {} } ]\n```\n\n### [Limit](https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/)(value)\n```typescript\nbuilder.Limit(10).build();\n\n// pipeline\n[ { $limit: 10 } ]\n```\n\n### [ListLocalSessions](https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/)(value)\n```typescript\nbuilder.ListLocalSessions({ allUsers: true }).build();\n\n// pipeline\n[ { $listLocalSessions: { allUsers: true } } ]\n```\n\n### [ListSampledQueries](https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/)(value)\n```typescript\nbuilder.ListSampledQueries({ namespace: \"social.post\" }).build();\n\n// pipeline\n[ { $listSampledQueries: { namespace: 'social.post' } } ]\n```\n\n### [ListSearchIndexes](https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/)(value)\n```typescript\nbuilder.ListSearchIndexes({ name: 'searchIndex01' }).build();\n\n// pipeline\n[ { $listSearchIndexes: { name: 'searchIndex01' } } ]\n```\n\n### [ListSessions](https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/)(value)\n```typescript\nbuilder.ListSessions({ allUsers: true }).build();\n\n// pipeline\n[ { $listSessions: { allUsers: true } } ]\n```\n\n### [Lookup](https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/)(value)\n#### Helper: `LookupConditionHelper(from, as, optional)`\n```typescript\nbuilder.Lookup(LookupConditionHelper('users', 'users')).build();\n\n// pipeline\n[ { $lookup: { from: 'users', as: 'users' } } ]\n```\n#### Helper: `LookupEqualityHelper(from, as, localField, foreignField)`\n```typescript\nbuilder.Lookup(\n  LookupEqualityHelper('users', 'users', 'userId', 'id')\n).build();\n\n// pipeline\n[\n  {\n    $lookup: {\n      from: 'users',\n      localField: 'userId',\n      foreignField: 'id',\n      as: 'users'\n    }\n  }\n]\n```\n\n### [Match](https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/)(value)\n#### Helper: `Field(name, value)`\n```typescript\nbuilder.Match(Field('age', 18)).build();\n\n// pipeline\n[ { $match: { age: 18 } } ]\n```\n#### Operator: `$Expression`\n```typescript\nbuilder.Match($Expression($GreaterThanEqual('$age', 18))).build();\n\n// pipeline\n[ { $match: { '$expr': { '$gte': [ '$age', 18 ] } } } ]\n```\n\n### [Merge](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/)(value)\n#### Helper: `MergeHelper(into, optional)`\n```typescript\nbuilder.Merge(MergeHelper('newCollection')).build();\n\n// pipeline\n[ { $merge: { into: 'newCollection' } } ]\n```\n\n### [Out](https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/)(value)\n#### Helper: `OutHelper(collection, optional)`\n```typescript\nbuilder.Out(OutHelper('users')).build();\n\n// pipeline\n[ { $out: 'users' } ]\n```\n\n### [PlanCacheStats](https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/)()\n```typescript\nbuilder.PlanCacheStats().build();\n\n// pipeline\n[ { $planCacheStats: {} } ]\n```\n\n### [Project](https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/)(...values)\n#### Helper: `ProjectHelper(field, value)`\n```typescript\nbuilder.Project(\n  ProjectHelper('age', '$user.age'),\n  ProjectHelper(\n    'nickname',\n    {\n      $cond: {\n        if: { $eq: [ '', '$user.nickname' ] },\n        then: '$$REMOVE',\n        else: '$user.nickname',\n      },\n    },\n  ),\n).build();\n\n// pipeline\n[\n  {\n    $project: {\n      age: '$user.age',\n      nickname: {\n        $cond: {\n          if: { $eq: [ '', '$user.nickname' ] },\n          then: '$$REMOVE',\n          else: '$user.nickname'\n        }\n      }\n    }\n  }\n]\n```\n#### Helper: `ProjectIgnoreHelper(...fields)`\n```typescript\nbuilder.Project(ProjectIgnoreHelper('password', 'refreshToken')).build();\n\n// pipeline\n[ { $project: { password: 0, refreshToken: 0 } } ]\n```\n#### Helper: `ProjectOnlyHelper(...fields)`\n```typescript\nbuilder.Project(ProjectOnlyHelper('password', 'refreshToken')).build();\n\n// pipeline\n[ { $project: { _id: 0, password: 1, refreshToken: 1 } } ]\n```\n\n### [Redact](https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/)(value)\n```typescript\nbuilder.Redact(\n  $Condition(\n    $GreaterThan($Size($SetIntersection('$tags', ['STLW', 'G'])), 0),\n    '$$DESCEND',\n    '$$PRUNE'\n  )\n).build();\n\n// pipeline\n[\n  {\n    $redact: {\n      '$cond': [\n        { '$gt': [ { '$size': { '$setIntersection': [ '$tags', [ 'STLW', 'G' ] ] } }, 0 ] },\n        '$$DESCEND',\n        '$$PRUNE'\n      ]\n    }\n  }\n]\n```\n\n### [ReplaceRoot](https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/)(value)\n```typescript\nbuilder.ReplaceRoot({\n  newRoot: { full_name: { $concat : [ \"$first_name\", \" \", \"$last_name\" ] } }\n}).build();\n\n// pipeline\n[\n  {\n    $replaceRoot: {\n      newRoot: {\n        full_name: { '$concat': [ '$first_name', ' ', '$last_name' ] }\n      }\n    }\n  }\n]\n```\n\n### [ReplaceWith](https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/)(value)\n```typescript\nbuilder.ReplaceWith('$name').build();\n\n// pipeline\n[ { $replaceWith: '$name' } ]\n```\n\n### [Sample](https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/)(value)\n#### Helper: `SampleHelper(size)`\n```typescript\nbuilder.Sample(SampleHelper(6)).build();\n\n// pipeline\n[ { $sample: { size: 6 } } ]\n```\n\n### [Search](https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/)(value)\n#### Helper: `SearchHelper(operator | collector, optional)`\n```typescript\nbuilder.Search(\n  SearchHelper({\n    near: { path: 'released', origin: date, pivot: 7776000000 },\n  }),\n).build();\n\n// pipeline\n[\n  {\n    $search: {\n      near: { path: 'released', origin: date, pivot: 7776000000 },\n    },\n  }\n]\n```\n\n### [SearchMeta](https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/)(value)\n#### Helper: `SearchMetaHelper(collector, optional)`\n```typescript\nbuilder.SearchMeta(\n  SearchMetaHelper({\n    facet: {\n      operator: {\n        near: { path: 'released', origin: date, pivot: 7776000000 },\n      },\n      facets: {\n        test: { type: 'number', path: 'released', boundaries: [0, 100] },\n      },\n    },\n  })\n).build();\n\n// pipeline\n[\n  {\n    $searchMeta: {\n      facet: {\n        operator: {\n          near: { path: 'released', origin: date, pivot: 7776000000 },\n        },\n        facets: {\n          test: { type: 'number', path: 'released', boundaries: [0, 100] },\n        },\n      },\n    }\n  }\n]\n```\n\n### [Set](https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/)(...values)\n#### Helper: `Field(name, value)`\n```typescript\nbuilder.Set(Field('first', true), Field('second', 2)).build();\n\n// pipeline\n[ { $set: { first: true, second: 2 } } ]\n```\n\n### [SetWindowFields](https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/)(value)\n```typescript\nbuilder.SetWindowFields({\n  partitionBy: \"$state\",\n  sortBy: { orderDate: 1 },\n  output: {\n    cumulativeQuantityForState: {\n      $sum: \"$quantity\",\n      window: { documents: [ \"unbounded\", \"current\" ] }\n    }\n  }\n}).build();\n\n// pipeline\n[\n  {\n    $setWindowFields: {\n      partitionBy: '$state',\n      sortBy: { orderDate: 1 },\n      output: {\n        cumulativeQuantityForState: {\n          '$sum': '$quantity',\n          window: { documents: [ 'unbounded', 'current' ] }\n        }\n      }\n    }\n  }\n]\n```\n\n### [ShardedDataDistribution](https://www.mongodb.com/docs/manual/reference/operator/aggregation/shardedDataDistribution/)(value)\n```typescript\nbuilder.ShardedDataDistribution({}).build();\n\n// pipeline\n[ { $shardedDataDistribution: {} } ]\n```\n\n### [Skip](https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/)(value)\n```typescript\nbuilder.Skip(100).build();\n\n// pipeline\n[ { $skip: 100 } ]\n```\n\n### [Sort](https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/)(...values)\n#### Helper: `Field(name, value)`\n```typescript\nbuilder.Sort(\n  Field('first', -1),\n  Field('second', 1),\n  Field('third', { $meta: \"textScore\" }),\n).build();\n\n// pipeline\n[\n  {\n    $sort: { first: -1, second: 1, third: { '$meta': 'textScore' } }\n  }\n]\n```\n\n### [SortByCount](https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/)(value)\n```typescript\nbuilder.SortByCount('$employee').build();\n// pipeline\n\n[ { $sortByCount: '$employee' } ]\n```\n\n### [UnionWith](https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/)(value)\n#### Helper: `UnionWithHelper(collection, pipeline)`\n```typescript\nbuilder.UnionWith(\n  UnionWithHelper('cars'),\n).build();\n\n// pipeline\n[\n  {\n    $unionWith: { coll: 'cars' }\n  }\n]\n```\n```typescript\nbuilder.UnionWith(\n  UnionWithHelper(\n    undefined,\n    [{ $document: [{ ref: 1 }, { ref: 2 }, { ref: 3 }],  }]),\n).build();\n\n// pipeline\n[\n  {\n    $unionWith: { pipeline: [ { '$document': [ { ref: 1 }, { ref: 2 }, { ref: 3 } ] } ] }\n  }\n]\n```\n```typescript\nbuilder.UnionWith(\n  UnionWithHelper('cars', [{ $match: { color: 'red' } }]),\n).build();\n\n// pipeline\n[\n  {\n    $unionWith: { coll: 'cars', pipeline: [ { '$match': { color: 'red' } } ] }\n  }\n]\n```\n\n### [Unset](https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/)(...values)\n```typescript\nbuilder.Unset('users', 'roles').build();\n\n// pipeline\n[ { $unset: [ 'users', 'roles' ] } ]\n```\n\n### [Unwind](https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/)(value)\n```typescript\nbuilder.Unwind({ path: '$sizes', preserveNullAndEmptyArrays: true }).build();\n\n// pipeline\n[ { $unwind: { path: '$sizes', preserveNullAndEmptyArrays: true } } ]\n```\n\n___\n\n\n# [MONGODB OPERATORS](https://docs.mongodb.com/manual/reference/operator/aggregation/)\n\n#### [$Absolute](https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/)\n```typescript\n$Absolute(-5)\n\n// operator\n{ $abs: -5 }\n```\n#### [$Accumulator](https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/)\n```typescript\n$Accumulator(\n  () =\u003e ({ count: 0, sum: 0 }),\n  (state: { count: number; sum: number; }, numCopies: number) =\u003e ({\n    count: state.count + 1,\n    sum: state.sum + numCopies,\n  }),\n  ['$copies'],\n  (state1: { count: number; sum: number; }, state2: { count: number; sum: number; }) =\u003e ({\n    count: state1.count + state2.count,\n    sum: state1.sum + state2.sum,\n  }),\n  { finalize: (state: { sum: number; count: number; }) =\u003e (state.sum / state.count) },\n)\n\n// operator\n{\n  '$accumulator': {\n    init: [ () =\u003e ({ count: 0, sum: 0 }) ],\n    accumulate: [\n      (state: { count: number; sum: number; }, numCopies: number) =\u003e ({\n        count: state.count + 1,\n        sum: state.sum + numCopies,\n      })\n    ],\n    accumulateArgs: [ '$copies' ],\n    merge: [\n      (state1: { count: number; sum: number; }, state2: { count: number; sum: number; }) =\u003e ({\n        count: state1.count + state2.count,\n        sum: state1.sum + state2.sum,\n      })\n    ],\n    finalize: [ (state: { sum: number; count: number; }) =\u003e (state.sum / state.count) ],\n    lang: 'js'\n  }\n}\n```\n#### [$ArcCosine](https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/)\n```typescript\n$ArcCosine({ $divide : [ '$side_b', '$hypotenuse' ] })\n\n// operator\n{ '$acos': { '$divide': [ '$side_b', '$hypotenuse' ] } }\n```\n#### [$ArcCosineHyperbolic](https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/)\n```typescript\n$ArcCosineHyperbolic(3)\n\n// operator\n{ '$acosh': 3 }\n```\n#### [$Add](https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/)\n```typescript\n$Add('$price', 10)\n\n// operator\n{ '$add': [ '$price', 10 ] }\n```\n#### [$AddToSet](https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/)\n```typescript\n$AddToSet('$item')\n\n// operator\n{ '$addToSet': '$item' }\n```\n#### [$AllElementsTrue](https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/)\n```typescript\n$AllElementsTrue([ true, 1, \"someString\" ])\n\n// operator\n{ '$allElementsTrue': [ [ true, 1, 'someString' ] ] }\n```\n#### [$And](https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/)\n```typescript\n$And(1, 'green')\n\n// operator\n{ '$and': [ 1, 'green' ] }\n```\n#### [$AnyElementTrue](https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/)\n```typescript\n$AnyElementTrue([ true, false ])\n\n// operator\n{ '$anyElementTrue': [ [ true, false ] ] }\n```\n#### [$ArrayElementAt](https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/)\n```typescript\n$ArrayElementAt([ 1, 2, 3 ], 0)\n\n// operator\n{ '$arrayElemAt': [ [ 1, 2, 3 ], 0 ] }\n```\n#### [$ArrayToObject](https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/)\n```typescript\n$ArrayToObject([ { \"k\": \"item\", \"v\": \"abc123\" }, { \"k\": \"qty\", \"v\": \"$qty\" } ])\n\n// operator\n{ '$arrayToObject': [ { k: 'item', v: 'abc123' }, { k: 'qty', v: '$qty' } ] }\n```\n```typescript\n$ArrayToObject([ [ \"item\", \"abc123\" ], [ \"qty\", 25 ] ], true)              \n\n// operator\n{ '$arrayToObject': { '$literal': [ [ 'item', 'abc123' ], [ 'qty', 25 ] ] } }\n```\n#### [$ArcSine](https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/)\n```typescript\n$ArcSine('$value')\n\n// operator\n{ '$asin': '$value' }\n```\n#### [$ArcSineHyperbolic](https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/)\n```typescript\n$ArcSineHyperbolic('$value')\n\n// operator\n{ '$asinh': '$value' }\n```\n#### [$ArcTangent](https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/)\n```typescript\n$ArcTangent('$value')\n\n// operator\n{ '$atan': '$value' }\n```\n#### [$ArcTangent2](https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/)\n```typescript\n$ArcTangent2('$side_b', '$side_a')\n\n// operator\n{ '$atan2': [ '$side_b', '$side_a' ] }\n```\n#### [$ArcTangentHyperbolic](https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/)\n```typescript\n$ArcTangentHyperbolic('$value')\n\n// operator\n{ '$atanh': '$value' }\n```\n#### [$Average](https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/)\n```typescript\n$Average('$value')\n\n// operator\n{ '$avg': '$value' }\n```\n```typescript\n$Average('$value1', '$value2', '$value3')\n\n// operator\n{ '$avg': [ '$value1', '$value2', '$value3' ] }\n```\n#### [$BinarySize](https://www.mongodb.com/docs/manual/reference/operator/aggregation/binarySize/)\n```typescript\n$BinarySize('Hello World!')\n\n// operator\n{ '$binarySize': 'Hello World!' }\n```\n#### [$BitwiseAnd](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/#mongodb-expression-exp.-bitAnd)\n```typescript\n$BitwiseAnd('$array')\n\n// operator\n{ '$bitAnd': '$array' }\n```\n```typescript\n$BitwiseAnd(0, 127, 5)\n\n// operator\n{ '$bitAnd': [ 0, 127, 5 ] }\n```\n#### [$BitwiseNot](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/#mongodb-expression-exp.-bitNot)\n```typescript\n$BitwiseNot('$long')\n\n// operator\n{ '$bitNot': '$long' }\n```\n#### [$BitwiseOr](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/#mongodb-expression-exp.-bitOr)\n```typescript\n$BitwiseOr('$array')\n\n// operator\n{ '$bitOr': '$array' }\n```\n```typescript\n$BitwiseOr(0, 127, 5)\n\n// operator\n{ '$bitOr': [ 0, 127, 5 ] }\n```\n#### [$BitwiseXor](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/#mongodb-expression-exp.-bitXor)\n```typescript\n$BitwiseXor('$array')\n\n// operator\n{ '$bitXor': '$array' }\n```\n```typescript\n$BitwiseXor(0, 127, 5)\n\n// operator\n{ '$bitXor': [ 0, 127, 5 ] }\n```\n#### [$Bottom](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/#mongodb-group-grp.-bottom)\n```typescript\n$Bottom(['field1', 'field2'], { field2: -1 })\n\n// operator\n{ '$bottom': { output: [ 'field1', 'field2' ], sortBy: { field2: -1 } } }\n```\n#### [$BottomN](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/#mongodb-group-grp.-bottomN)\n```typescript\n$BottomN('field', { field: 1 }, 3)\n\n// operator\n{ '$bottomN': { output: 'field', sortBy: { field: 1 }, n: 3 } }\n```\n#### [$BsonSize](https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/)\n```typescript\n$BsonSize('$$ROOT')\n\n// operator\n{ '$bsonSize': '$$ROOT' }\n```\n#### [$Ceil](https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/)\n```typescript\n$Ceil('$value')\n\n// operator\n{ '$ceil': '$value' }\n```\n#### [$Compare](https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/)\n```typescript\n$Compare('$age', 25)\n\n// operator\n{ '$cmp': [ '$age', 25 ] }\n```\n#### [$Concat](https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/)\n```typescript\n$Concat('$first', ' - ', '$second')\n\n// operator\n{ '$concat': [ '$first', ' - ', '$second' ] }\n```\n#### [$ConcatArrays](https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/)\n```typescript\n$ConcatArrays('$array', [1, 2, 3])\n\n// operator\n{ '$concatArrays': [ '$array', [ 1, 2, 3 ] ] }\n```\n#### [$Condition](https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/)\n```typescript\n$Condition({ $gte: [ '$quantity', 250 ] }, 'true', 'false')\n\n// operator\n{ '$cond': [ { '$gte': [ '$quantity', 250 ] }, 'true', 'false' ] }\n```\n#### [$Convert](https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/)\n```typescript\n$Convert(100, 'bool')\n\n// operator\n{ '$convert': { input: 100, to: 'bool' } }\n```\n#### [$Cosine](https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/)\n```typescript\n$Cosine('$angle')\n\n// operator\n{ '$cos': '$angle' }\n```\n#### [$CosineHyperbolic](https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/)\n```typescript\n$CosineHyperbolic({ $degreesToRadians : \"$angle\" })\n\n// operator\n{ '$cosh': { '$degreesToRadians': '$angle' } }\n```\n#### [$Count](https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/)\n```typescript\n$Count()\n\n// operator\n{ '$count': {} }\n```\n#### [$CovariancePopulation](https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/)\n```typescript\n$CovariancePopulation('$numeric1', '$numeric2')\n\n// operator\n{ '$covariancePopulation': [ '$numeric1', '$numeric2' ] }\n```\n#### [$CovarianceSample](https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/)\n```typescript\n$CovarianceSample('$numeric1', '$numeric2')\n\n// operator\n{ '$covarianceSample': [ '$numeric1', '$numeric2' ] }\n```\n#### [$DateAdd](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/)\n```typescript\n$DateAdd('$startDate', 'hour', 2)\n\n// operator\n{ '$dateAdd': { startDate: '$startDate', unit: 'hour', amount: 2 } }\n```\n#### [$DateDifference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/)\n```typescript\n$DateDifference('$startDate', '$endDate', 'second')\n\n// operator\n{ '$dateDiff': { startDate: '$startDate', endDate: '$endDate', unit: 'second' } }\n```\n#### [$DateFromParts](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/)\n```typescript\n$DateFromCalendarParts(2000, { month: 12, day: 31, hour: 12, minute: 25, second: 59, timezone: '+01:00' })\n\n// operator\n{\n  '$dateFromParts': {\n    year: 2000,\n    month: 12,\n    day: 31,\n    hour: 12,\n    minute: 25,\n    second: 59,\n    timezone: '+01:00'\n  }\n}\n```\n```typescript\n$DateFromIsoWeekParts(2000, { isoWeek: 53, isoDayOfWeek: 7, millisecond: 500 })\n\n// operator\n{ '$dateFromParts': { isoWeekYear: 2000, isoWeek: 53, isoDayOfWeek: 7, millisecond: 500 } }\n```\n#### [$DateFromString](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/)\n```typescript\n$DateFromString('2017-02-08T12:10:40.787', { timezone: 'America/New_York' })\n\n// operator\n{\n  '$dateFromString': {\n    dateString: '2017-02-08T12:10:40.787',\n    timezone: 'America/New_York'\n  }\n}\n```\n#### [$DateSubtract](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/)\n```typescript\n$DateSubtract(1697382106124, 'month', 1)\n\n// operator\n{ '$dateSubtract': { startDate: 1697382106124, unit: 'month', amount: 1 } }\n```\n#### [$DateToParts](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/)\n```typescript\n$DateToParts(1697382106124)\n\n// operator\n{ '$dateToParts': { date: 1697382106124 } }\n```\n#### [$DateToString](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/)\n```typescript\n$DateToString(1697382106124)\n\n// operator\n{ '$dateToString': { date: 1697382106124 } }\n```\n#### [$DateTrunc](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/)\n```typescript\n$DateTrunc(1697382106124, 'month')\n\n// operator\n{ '$dateTrunc': { date: 1697382106124, unit: 'month' } }\n```\n#### [$DayOfMonth](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/)\n```typescript\n$DayOfMonth('$date', 'Europe/Paris')\n\n// operator\n{ '$dayOfMonth': { date: '$date', timezone: 'Europe/Paris' } }\n```\n#### [$DayOfWeek](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/)\n```typescript\n$DayOfWeek('$date', '+03:30')\n\n// operator\n{ '$dayOfWeek': { date: '$date', timezone: '+03:30' } }\n```\n#### [$DayOfYear](https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/)\n```typescript\n$DayOfYear('$date')\n\n// operator\n{ '$dayOfYear': { date: '$date' } }\n```\n#### [$DegreesToRadians](https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/)\n```typescript\n$DegreesToRadians('$angle_a')\n\n// operator\n{ '$degreesToRadians': '$angle_a' }\n```\n#### $DenseRank\n```typescript\n\n\n// operator\n\n```\n#### $Derivative\n```typescript\n\n\n// operator\n\n```\n#### $Divide\n```typescript\n\n\n// operator\n\n```\n#### $DocumentNumber\n```typescript\n\n\n// operator\n\n```\n#### $Equal\n```typescript\n\n\n// operator\n\n```\n#### $Exponent\n```typescript\n\n\n// operator\n\n```\n#### $ExponentialMovingAverage\n```typescript\n\n\n// operator\n\n```\n#### $Filter\n```typescript\n\n\n// operator\n\n```\n#### $First\n```typescript\n\n\n// operator\n\n```\n#### $FirstN\n```typescript\n\n\n// operator\n\n```\n```typescript\n\n\n// operator\n\n```\n#### $Floor\n```typescript\n\n\n// operator\n\n```\n#### $Function\n```typescript\n\n\n// operator\n\n```\n#### $GetField\n```typescript\n\n\n// operator\n\n```\n#### $GreaterThan\n```typescript\n\n\n// operator\n\n```\n#### $GreaterThanEqual\n```typescript\n\n\n// operator\n\n```\n#### $Hour\n```typescript\n\n\n// operator\n\n```\n#### $IfNull\n```typescript\n\n\n// operator\n\n```\n#### $In\n```typescript\n\n\n// operator\n\n```\n#### $IndexOfArray\n```typescript\n\n\n// operator\n\n```\n#### $IndexOfBytes\n```typescript\n\n\n// operator\n\n```\n#### $IndexOfCodePoint\n```typescript\n\n\n// operator\n\n```\n#### $Integral\n```typescript\n\n\n// operator\n\n```\n#### $IsArray\n```typescript\n\n\n// operator\n\n```\n#### $IsNumber\n```typescript\n\n\n// operator\n\n```\n#### $IsoDayOfWeek\n```typescript\n\n\n// operator\n\n```\n#### $IsoWeek\n```typescript\n\n\n// operator\n\n```\n#### $IsoWeekYear\n```typescript\n\n\n// operator\n\n```\n#### $Last\n```typescript\n\n\n// operator\n\n```\n#### $LastN\n```typescript\n\n\n// operator\n\n```\n```typescript\n\n\n// operator\n\n```\n#### $LessThan\n```typescript\n\n\n// operator\n\n```\n#### $LessThanEqual\n```typescript\n\n\n// operator\n\n```\n#### $Let\n```typescript\n\n\n// operator\n\n```\n#### $Literal\n```typescript\n\n\n// operator\n\n```\n#### $Log\n```typescript\n\n\n// operator\n\n```\n#### $Log10\n```typescript\n\n\n// operator\n\n```\n#### $Ltrim\n```typescript\n\n\n// operator\n\n```\n#### $Map\n```typescript\n\n\n// operator\n\n```\n#### $Max\n```typescript\n\n\n// operator\n\n```\n#### $MergeObjects\n```typescript\n\n\n// operator\n\n```\n#### $Meta\n```typescript\n\n\n// operator\n\n```\n#### $Millisecond\n```typescript\n\n\n// operator\n\n```\n#### $Min\n```typescript\n\n\n// operator\n\n```\n#### $Minute\n```typescript\n\n\n// operator\n\n```\n#### $Mod\n```typescript\n\n\n// operator\n\n```\n#### $Month\n```typescript\n\n\n// operator\n\n```\n#### $Multiply\n```typescript\n\n\n// operator\n\n```\n#### $NaturalLog\n```typescript\n\n\n// operator\n\n```\n#### $Not\n```typescript\n\n\n// operator\n\n```\n#### $NotEqual\n```typescript\n\n\n// operator\n\n```\n#### $ObjectToArray\n```typescript\n\n\n// operator\n\n```\n#### $Or\n```typescript\n\n\n// operator\n\n```\n#### $Pow\n```typescript\n\n\n// operator\n\n```\n#### $Push\n```typescript\n\n\n// operator\n\n```\n#### $RadiansToDegrees\n```typescript\n\n\n// operator\n\n```\n#### $Rand\n```typescript\n\n\n// operator\n\n```\n#### $Range\n```typescript\n\n\n// operator\n\n```\n#### $Reduce\n```typescript\n\n\n// operator\n\n```\n#### $RegexFind\n```typescript\n\n\n// operator\n\n```\n#### $RegexFindAll\n```typescript\n\n\n// operator\n\n```\n#### $RegexMatch\n```typescript\n\n\n// operator\n\n```\n#### $ReplaceAll\n```typescript\n\n\n// operator\n\n```\n#### $ReplaceOne\n```typescript\n\n\n// operator\n\n```\n#### $ReverseArray\n```typescript\n\n\n// operator\n\n```\n#### $Round\n```typescript\n\n\n// operator\n\n```\n#### $Rtrim\n```typescript\n\n\n// operator\n\n```\n#### $SampleRate\n```typescript\n\n\n// operator\n\n```\n#### $Second\n```typescript\n\n\n// operator\n\n```\n#### $SetDifference\n```typescript\n\n\n// operator\n\n```\n#### $SetEquals\n```typescript\n\n\n// operator\n\n```\n#### $SetIntersection\n```typescript\n\n\n// operator\n\n```\n#### $SetIsSubset\n```typescript\n\n\n// operator\n\n```\n#### $SetUnion\n```typescript\n\n\n// operator\n\n```\n#### $Sin\n```typescript\n\n\n// operator\n\n```\n#### $Sinh\n```typescript\n\n\n// operator\n\n```\n#### $Size\n```typescript\n\n\n// operator\n\n```\n#### $Slice\n```typescript\n\n\n// operator\n\n```\n#### $Split\n```typescript\n\n\n// operator\n\n```\n#### $Sqrt\n```typescript\n\n\n// operator\n\n```\n#### $StdDevPop\n```typescript\n\n\n// operator\n\n```\n#### $StdDevSamp\n```typescript\n\n\n// operator\n\n```\n#### $StrCaseCmp\n```typescript\n\n\n// operator\n\n```\n#### $StrLenBytes\n```typescript\n\n\n// operator\n\n```\n#### $StrLenCP\n```typescript\n\n\n// operator\n\n```\n#### $Substr\n```typescript\n\n\n// operator\n\n```\n#### $SubstrBytes\n```typescript\n\n\n// operator\n\n```\n#### $SubstrCP\n```typescript\n\n\n// operator\n\n```\n#### $Subtract\n```typescript\n\n\n// operator\n\n```\n#### $Sum\n```typescript\n\n\n// operator\n\n```\n#### $Switch\n```typescript\n\n\n// operator\n\n```\n#### $Tan\n```typescript\n\n\n// operator\n\n```\n#### $Tanh\n```typescript\n\n\n// operator\n\n```\n#### $ToBool\n```typescript\n\n\n// operator\n\n```\n#### $ToDate\n```typescript\n\n\n// operator\n\n```\n#### $ToDecimal\n```typescript\n\n\n// operator\n\n```\n#### $ToDouble\n```typescript\n\n\n// operator\n\n```\n#### $ToInt\n```typescript\n\n\n// operator\n\n```\n#### $ToLong\n```typescript\n\n\n// operator\n\n```\n#### $ToLower\n```typescript\n\n\n// operator\n\n```\n#### $ToObjectId\n```typescript\n\n\n// operator\n\n```\n#### $ToString\n```typescript\n\n\n// operator\n\n```\n#### $ToUpper\n```typescript\n\n\n// operator\n\n```\n#### $Trim\n```typescript\n\n\n// operator\n\n```\n#### $Trunc\n```typescript\n\n\n// operator\n\n```\n#### $Type\n```typescript\n\n\n// operator\n\n```\n#### $Week\n```typescript\n\n\n// operator\n\n```\n#### $Year\n```typescript\n\n\n// operator\n\n```\n#### $Zip\n```typescript\n\n\n// operator\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikedev75015%2Fmongodb-pipeline-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikedev75015%2Fmongodb-pipeline-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikedev75015%2Fmongodb-pipeline-builder/lists"}