Skip to content

Commit 893b556

Browse files
DOCSP-13653 Support background out to Atlas (#106)
1 parent 0d805e6 commit 893b556

File tree

2 files changed

+71
-43
lines changed

2 files changed

+71
-43
lines changed

source/reference/pipeline/out.txt

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,7 @@ Options
387387

388388
* - ``background``
389389
- boolean
390-
- For |out| to |s3| only.
391-
392-
Flag to run aggregation operations in the background. If
390+
- Flag to run aggregation operations in the background. If
393391
omitted, defaults to ``false``. When set to ``true``, {+adl+}
394392
runs the queries in the background.
395393

@@ -509,7 +507,6 @@ Examples
509507
same ``sale-date`` value. |out| names each file using the
510508
documents' ``sale-date`` value converted to a string.
511509

512-
513510
*Multiple Fields from Documents*
514511

515512
.. example::
@@ -608,46 +605,17 @@ Examples
608605
- A string value of part ID from the ``part-id`` field, and
609606
- A forward slash (``/``).
610607

611-
**Run Query in the background**
612-
613-
The following example shows |out| syntax for running an
614-
aggregation pipeline that ends with the |out| stage in the
615-
background.
616-
617-
.. code-block:: json
618-
:emphasize-lines: 16
619-
620-
db.foo.aggregate([
621-
{
622-
"$out" : {
623-
"s3" : {
624-
"bucket" : "my-s3-bucket",
625-
"region" : "us-east-1",
626-
"filename" : {
627-
"$toString" : "$sale-date"
628-
},
629-
"format" : {
630-
"name" : "json"
631-
}
632-
}
633-
}
634-
}
635-
], { background: true })
636-
637-
|out| writes to |json| files in the root of the bucket in the
638-
background. Each |json| file contains all of the documents
639-
with the same ``sale-date`` value. |out| names each file using
640-
the documents' ``sale-date`` value converted to a string.
641-
642608
.. tab:: Atlas Cluster
643609
:tabid: atlas
644610

645-
.. example::
611+
**Write to Collection on Atlas Cluster**
646612

647-
This |out| syntax sends the aggregated data to a
648-
``sampleDB.mySampleData`` collection in the |service| cluster
649-
named ``myTestCluster``. The syntax doesn't specify a project
650-
ID; |out| uses the ID of the project that contains your {+dl+}.
613+
This |out| syntax sends the aggregated data to a
614+
``sampleDB.mySampleData`` collection in the |service| cluster
615+
named ``myTestCluster``. The syntax doesn't specify a project ID;
616+
|out| uses the ID of the project that contains your {+dl+}.
617+
618+
.. example::
651619

652620
.. code-block:: json
653621
:linenos:
@@ -662,6 +630,65 @@ Examples
662630
}
663631
}
664632

633+
**Run Query in the background**
634+
635+
The following example shows |out| syntax for running an aggregation
636+
pipeline that ends with the |out| stage in the background.
637+
638+
.. tabs::
639+
:hidden:
640+
641+
.. tab:: S3
642+
:tabid: s3
643+
644+
.. example::
645+
646+
.. code-block:: json
647+
:emphasize-lines: 16
648+
649+
db.foo.aggregate([
650+
{
651+
"$out" : {
652+
"s3" : {
653+
"bucket" : "my-s3-bucket",
654+
"region" : "us-east-1",
655+
"filename" : {
656+
"$toString" : "$sale-date"
657+
},
658+
"format" : {
659+
"name" : "json"
660+
}
661+
}
662+
}
663+
}
664+
], { background: true })
665+
666+
|out| writes to |json| files in the root of the bucket in the
667+
background. Each |json| file contains all of the documents
668+
with the same ``sale-date`` value. |out| names each file using
669+
the documents' ``sale-date`` value converted to a string.
670+
671+
.. tab:: Atlas Cluster
672+
:tabid: atlas
673+
674+
.. example::
675+
676+
.. code-block:: json
677+
:emphasize-lines: 9
678+
679+
{
680+
"$out": {
681+
"atlas": {
682+
"clusterName": "myTestCluster",
683+
"db": "sampleDB",
684+
"coll": "mySampleData"
685+
}
686+
}
687+
}, { background: true })
688+
689+
|out| writes to ``sampleDB.mySampleData`` collection in the
690+
|service| cluster named ``myTestCluster`` in the background.
691+
665692
.. _adl-out-stage-limitations:
666693

667694
.. tabs::

source/supported-unsupported/mql-support.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ Aggregation Commands
4545
and ``background`` options only. For the ``comment`` option,
4646
{+adl+} supports only type ``string``. {+adl+} supports
4747
``{"background" : <boolean>}`` option for
48-
:ref:`adl-out-stage` to |s3| only. The ``background`` option
49-
is not available for other :manual:`aggregation pipeline
50-
stages </reference/operator/aggregation-pipeline>`. See
48+
:ref:`adl-out-stage` to |s3| and |service| cluster only. The
49+
``background`` option is not available for other
50+
:manual:`aggregation pipeline stages
51+
</reference/operator/aggregation-pipeline>`. See
5152
:ref:`$out Options <adl-out-stage-options>` for more
5253
information.
5354
* {+adl+} supports :pipeline:`$geoNear` and

0 commit comments

Comments
 (0)