Skip to content

Backport 1053 to v6.16 (manual) #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: v6.16
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion config/redirects
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,63 @@ raw: ${prefix}/stable -> ${base}/current/
[*-v5.5]: ${prefix}/${version}/fundamentals/run-command/ -> ${base}/${version}/usage-examples/command/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/change-a-document/ -> ${base}/${version}/fundamentals/crud/write-operations/modify/

[*-v6.0): ${prefix}/${version}/fundamentals/connection/socks/ -> ${base}/${version}/
[*-v6.0]: ${prefix}/${version}/fundamentals/connection/socks/ -> ${base}/${version}/

[*-master]: ${prefix}/${version}/quick-start/download-and-install/ -> ${base}/${version}/get-started/
[*-master]: ${prefix}/${version}/quick-start/create-a-deployment/ -> ${base}/${version}/get-started/
[*-master]: ${prefix}/${version}/quick-start/create-a-connection-string/ -> ${base}/${version}/get-started/
[*-master]: ${prefix}/${version}/quick-start/connect-to-mongodb/ -> ${base}/${version}/get-started/
[*-master]: ${prefix}/${version}/quick-start/next-steps/ -> ${base}/${version}/get-started/
[*-master]: ${prefix}/${version}/fundamentals/connection/ -> ${base}/${version}/connect/
[*-master]: ${prefix}/${version}/fundamentals/connection/connect/ -> ${base}/${version}/connect/mongoclient/
[*-master]: ${prefix}/${version}/fundamentals/connection/connection-options/ -> ${base}/${version}/connect/connection-options/
[*-master]: ${prefix}/${version}/connection-troubleshooting/ -> ${base}/${version}/connect/connection-troubleshooting/
[*-master]: ${prefix}/${version}/fundamentals/connection/network-compression/ -> ${base}/${version}/connect/connection-options/network-compression/
[*-master]: ${prefix}/${version}/fundamentals/connection/csot/ -> ${base}/${version}/connect/connection-options/csot/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/bulk/ -> ${base}/${version}/crud/bulk-write/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/insert/ -> ${base}/${version}/crud/insert/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/upsert/ -> ${base}/${version}/crud/update/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/delete/ -> ${base}/${version}/crud/delete/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/ -> ${base}/${version}/crud/query/
[*-master]: ${prefix}/${version}/fundamentals/crud/query-document/ -> ${base}/${version}/crud/query/query-document/
[*-master]: ${prefix}/${version}/fundamentals/crud/compound-operations/ -> ${base}/${version}/crud/compound-operations/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-write-pref/ -> ${base}/${version}/crud/read-write-pref/
[*-master]: ${prefix}/${version}/fundamentals/transactions/ -> ${base}/${version}/crud/transactions/
[*-master]: ${prefix}/${version}/fundamentals/gridfs/ -> ${base}/${version}/crud/gridfs/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/retrieve/ -> ${base}/${version}/crud/query/retrieve/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/project/ -> ${base}/${version}/crud/query/project/
[*-master]: ${prefix}/${version}/fundamentals/usage-examples/count/ -> ${base}/${version}/crud/query/count/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/distinct/ -> ${base}/${version}/crud/query/distinct/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/cursor/ -> ${base}/${version}/crud/query/cursor/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/geo/ -> ${base}/${version}/crud/query/geo/
[*-master]: ${prefix}/${version}/fundamentals/crud/time-series/ -> ${base}/${version}/data-formats/time-series/
[*-master]: ${prefix}/${version}/fundamentals/bson/ -> ${base}/${version}/data-formats/bson/
[*-master]: ${prefix}/${version}/fundamentals/indexes/ -> ${base}/${version}/indexes/
[*-master]: ${prefix}/${version}/fundamentals/run-command/ -> ${base}/${version}/run-command/
[*-master]: ${prefix}/${version}/fundamentals/monitoring/ -> ${base}/${version}/monitoring-and-logging/monitoring/
[*-master]: ${prefix}/${version}/fundamentals/logging/ -> ${base}/${version}/monitoring-and-logging/logging/
[*-master]: ${prefix}/${version}/usage-examples/changeStream -> ${base}/monitoring-and-logging/change-streams/
[*-master]: ${prefix}/${version}/fundamentals/aggregation/ -> ${base}/${version}/aggregation/
[*-master]: ${prefix}/${version}/aggregation-tutorials/ -> ${base}/aggregation/
[*-master]: ${prefix}/${version}/aggregation-tutorials/filtered-subset/ -> ${base}/aggregation/filtered-subset/
[*-master]: ${prefix}/${version}/aggregation-tutorials/group-total/ -> ${base}/aggregation/group-total/
[*-master]: ${prefix}/${version}/aggregation-tutorials/multi-field-join/ -> ${base}/aggregation/multi-field-join/
[*-master]: ${prefix}/${version}/aggregation-tutorials/one-to-one-join/ -> ${base}/aggregation/one-to-one-join/
[*-master]: ${prefix}/${version}/aggregation-tutorials/unpack-arrays/ -> ${base}/aggregation/unpack-arrays/
[*-master]: ${prefix}/${version}/fundamentals/authentication -> ${base}/security/authentication/
[*-master]: ${prefix}/${version}/fundamentals/authentication/mechanisms/ -> ${base}/security/authentication/mechanisms/
[*-master]: ${prefix}/${version}/fundamentals/authentication/enterprise-mechanisms/ -> ${base}/security/authentication/enterprise-mechanisms/
[*-master]: ${prefix}/${version}/fundamentals/encrypt-fields/ -> ${base}/security/encrypt-fields/
[*-master]: ${prefix}/${version}/fundamentals/connection/tls/ -> ${base}/security/tls/
[*-master]: ${prefix}/${version}/fundamentals/connection/socks/ -> ${base}/security/socks/
[*-master]: ${prefix}/${version}/fundamentals/typescript/ -> ${base}/typescript/
[*-master]: ${prefix}/${version}/whats-new/ -> ${base}/reference/release-notes/
[*-master]: ${prefix}/${version}/compatibility/ -> ${base}/reference/compatibility/
[*-master]: ${prefix}/${version}/upgrade/ -> ${base}/reference/upgrade/
[*-master]: ${prefix}/${version}/quick-reference/ -> ${base}/reference/quick-reference/
[*-master]: ${prefix}/${version}/fundamentals/collations/ -> ${base}/crud/configure/
[*-master]: ${prefix}/${version}/fundamentals/crud/read-operations/text/ -> ${base}/crud/query/text/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/modify/ -> ${base}/crud/update/modify/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/embedded-arrays/ -> ${base}/crud/update/embedded-arrays/
[*-master]: ${prefix}/${version}/fundamentals/crud/write-operations/pkFactory/ -> ${base}/crud/pkFactory/

19 changes: 12 additions & 7 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ intersphinx = [
]

toc_landing_pages = [
"/fundamentals/authentication",
"/fundamentals",
"/fundamentals/connection",
"/fundamentals/crud",
"/fundamentals/bson",
"/usage-examples",
"/quick-start",
"/get-started",
"/connect",
"/aggregation",
"/aggregation/aggregation-tutorials",
"/security",
"/security/authentication",
"/aggregation-tutorials",
"/data-formats",
"connect/connection-options",
"crud",
"/crud/query",
"crud/update",
"monitoring-and-logging"
]
sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"

Expand Down
124 changes: 0 additions & 124 deletions source/aggregation-tutorials.txt

This file was deleted.

116 changes: 114 additions & 2 deletions source/fundamentals/aggregation.txt → source/aggregation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@
Aggregation
===========

.. facet::
:name: genre
:values: reference

.. meta::
:description: Learn to use aggregation operations in the MongoDB Node.js Driver to create pipelines for data transformation and summarization.
:keywords: node.js, code example, runnable app

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

.. toctree::

Filtered Subset </aggregation/filtered-subset/>
Group & Total </aggregation/group-total/>
Unpack Arrays & Group </aggregation/unpack-arrays/>
One-to-One Join </aggregation/one-to-one-join/>
Multi-Field Join </aggregation/multi-field-join/>

.. _nodejs-aggregation-overview:

Overview
Expand Down Expand Up @@ -101,7 +113,7 @@ database:

.. tip::

For more information on connecting to your MongoDB deployment, see the :doc:`Connection Guide </fundamentals/connection>`.
For more information on connecting to your MongoDB deployment, see the :doc:`Connection Guide </connect>`.

Aggregation Example
~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -134,6 +146,106 @@ This example produces the following output:

For more information, see the `aggregate() API documentation <{+api+}/classes/Collection.html#aggregate>`__.

.. _node-aggregation-tutorials-landing:
.. _node-aggregation-tutorials:

Aggregation Tutorials
---------------------

Aggregation tutorials provide detailed explanations of common
aggregation tasks in a step-by-step format. The tutorials are adapted
from examples in the `Practical MongoDB Aggregations book
<https://www.practical-mongodb-aggregations.com/>`__ by Paul Done.

Each tutorial includes the following sections:

- **Introduction**, which describes the purpose and common use cases of the
aggregation type. This section also describes the example and desired
outcome that the tutorial demonstrates.

- **Before You Get Started**, which describes the necessary databases,
collections, and sample data that you must have before building the
aggregation pipeline and performing the aggregation.

- **Tutorial**, which describes how to build and run the aggregation
pipeline. This section describes each stage of the completed
aggregation tutorial, and then explains how to run and interpret the
output of the aggregation.

At the end of each aggregation tutorial, you can find a link to a fully
runnable Node.js code file that you can run in your environment.

.. tip::

To learn more about performing aggregations, see the
:ref:`node-aggregation` guide.

.. _node-agg-tutorial-template-app:

Aggregation Template App
~~~~~~~~~~~~~~~~~~~~~~~~

Before you begin following an aggregation tutorial, you must set up a
new Node.js app. You can use this app to connect to a MongoDB
deployment, insert sample data into MongoDB, and run the aggregation
pipeline in each tutorial.

.. tip::

To learn how to install the driver and connect to MongoDB,
see the :ref:`node-get-started-download-and-install` and
:ref:`node-get-started-create-deployment` steps of the
Quick Start guide.

Once you install the driver, create a file called
``agg_tutorial.js``. Paste the following code in this file to create an
app template for the aggregation tutorials:

.. literalinclude:: /includes/aggregation/template-app.js
:language: javascript
:copyable: true

.. important::

In the preceding code, read the code comments to find the sections of
the code that you must modify for the tutorial you are following.

If you attempt to run the code without making any changes, you will
encounter a connection error.

For every tutorial, you must replace the connection string placeholder with
your deployment's connection string.

.. tip::

To learn how to locate your deployment's connection string, see the
:ref:`node-get-started-connection-string` step of the Quick Start guide.

For example, if your connection string is
``"mongodb+srv://mongodb-example:27017"``, your connection string assignment resembles
the following:

.. code-block:: javascript
:copyable: false

const uri = "mongodb+srv://mongodb-example:27017";

To run the completed file after you modify the template for a
tutorial, run the following command in your shell:

.. code-block:: bash

node agg_tutorial.js

Available Tutorials
~~~~~~~~~~~~~~~~~~~

- :ref:`node-aggregation-filtered-subset`
- :ref:`node-aggregation-group-total`
- :ref:`node-aggregation-arrays`
- :ref:`node-aggregation-one-to-one`
- :ref:`node-aggregation-multi-field`

Additional Examples
~~~~~~~~~~~~~~~~~~~

Expand Down
Loading
Loading