Skip to content

Commit d9bae85

Browse files
DOCSP-13421 document background: true aggregation option (#99)
* DOCSP-13421 document background: true aggregation option * DOCSP-13421 updates for review feedback * DOCSP-13421 updates for feedback
1 parent 8c9c00b commit d9bae85

File tree

2 files changed

+104
-28
lines changed

2 files changed

+104
-28
lines changed

source/reference/pipeline/out.txt

Lines changed: 83 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
|out| takes documents returned by the aggregation pipeline and writes
2020
them to a specified collection. The |out| operator must be the last
21-
stage in the
22-
:manual:`aggregation pipeline </reference/operator/aggregation-pipeline/>`.
23-
In {+adl+}, you can use |out| to write data from any one of the
24-
:ref:`supported <datalake-configuration-file-overview>` {+data-lake-stores+}
25-
or multiple :ref:`supported <datalake-configuration-file-overview>`
26-
{+data-lake-stores+} when using :ref:`federated queries <federated-queries>`
27-
to any one of the following:
21+
stage in the :manual:`aggregation pipeline
22+
</reference/operator/aggregation-pipeline/>`. In {+adl+}, you can use
23+
|out| to write data from any one of the :ref:`supported
24+
<datalake-configuration-file-overview>` {+data-lake-stores+} or
25+
multiple :ref:`supported <datalake-configuration-file-overview>`
26+
{+data-lake-stores+} when using :ref:`federated queries
27+
<federated-queries>` to any one of the following:
2828

2929
- |s3| buckets with read and write permissions
3030
- |service| cluster :manual:`namespace
@@ -302,6 +302,40 @@ Fields
302302
the ID of the project that contains your {+dl+}.
303303
- Optional
304304

305+
.. _adl-out-stage-options:
306+
307+
Options
308+
-------
309+
310+
.. list-table::
311+
:header-rows: 1
312+
:widths: 20 10 60 10
313+
314+
* - Option
315+
- Type
316+
- Description
317+
- Necessity
318+
319+
* - ``background``
320+
- boolean
321+
- For |out| to |s3| only.
322+
323+
Flag to run aggregation operations in the background. If
324+
omitted, defaults to ``false``. When set to ``true``, {+adl+}
325+
runs the queries in the background.
326+
327+
.. code-block:: json
328+
:copyable: false
329+
330+
{ "background" : true }
331+
332+
Use this option if you want to submit other new queries without
333+
waiting for currently running queries to complete or disconnect
334+
your {+dl+} connection while the queries continue to run in the
335+
background.
336+
337+
- Optional
338+
305339
.. _adl-out-stage-egs:
306340

307341
Examples
@@ -313,12 +347,14 @@ Examples
313347
.. tab:: S3
314348
:tabid: s3
315349

350+
**Create a Filename**
351+
316352
The following examples show |out| syntaxes for dynamically
317353
creating a filename from a constant string or from the fields of
318354
the same or different data types in the documents that reach the
319355
|out| stage.
320356

321-
**Simple String Example**
357+
*Simple String Example*
322358

323359
.. example::
324360

@@ -373,7 +409,7 @@ Examples
373409
``big_box_store/3.bson.gz`` through
374410
``big_box_store/5.bson.gz``.
375411

376-
**Single Field from Documents**
412+
*Single Field from Documents*
377413

378414
.. example::
379415

@@ -405,7 +441,7 @@ Examples
405441
documents' ``sale-date`` value converted to a string.
406442

407443

408-
**Multiple Fields from Documents**
444+
*Multiple Fields from Documents*
409445

410446
.. example::
411447

@@ -452,7 +488,7 @@ Examples
452488
the documents' ``name`` and ``unique-id`` values.
453489

454490

455-
**Multiple Types of Fields from Documents**
491+
*Multiple Types of Fields from Documents*
456492

457493
.. example::
458494

@@ -490,9 +526,9 @@ Examples
490526
}
491527

492528
|out| writes 154 MiB of data to compressed |json| files, where
493-
each file contains all documents with the same ``store-number``,
494-
``sale-date``, and ``part-id`` values. To name each file, |out|
495-
concatenates:
529+
each file contains all documents with the same
530+
``store-number``, ``sale-date``, and ``part-id`` values. To
531+
name each file, |out| concatenates:
496532

497533
- A constant string value of ``big-box-store/``,
498534
- A string value of a unique store number in the
@@ -503,6 +539,37 @@ Examples
503539
- A string value of part ID from the ``part-id`` field, and
504540
- A forward slash (``/``).
505541

542+
**Run Query in the background**
543+
544+
The following example shows |out| syntax for running an
545+
aggregation pipeline that ends with the |out| stage in the
546+
background.
547+
548+
.. code-block:: json
549+
:emphasize-lines: 16
550+
551+
db.foo.aggregate([
552+
{
553+
"$out" : {
554+
"s3" : {
555+
"bucket" : "my-s3-bucket",
556+
"region" : "us-east-1",
557+
"filename" : {
558+
"$toString" : "$sale-date"
559+
},
560+
"format" : {
561+
"name" : "json"
562+
}
563+
}
564+
}
565+
}
566+
], { background: true })
567+
568+
|out| writes to |json| files in the root of the bucket in the
569+
background. Each |json| file contains all of the documents
570+
with the same ``sale-date`` value. |out| names each file using
571+
the documents' ``sale-date`` value converted to a string.
572+
506573
.. tab:: Atlas Cluster
507574
:tabid: atlas
508575

@@ -598,6 +665,7 @@ Examples
598665

599666
.. seealso::
600667

601-
- :manual:`$out Aggregation Stage Reference </reference/operator/aggregation/out>`
668+
- :manual:`$out Aggregation Stage Reference
669+
</reference/operator/aggregation/out>`
602670
- `Tutorial: Federated Queries and $out to S3
603671
<https://developer.mongodb.com/how-to/atlas-data-lake-federated-queries-out-aws-s3>`__

source/supported-unsupported/mql-support.txt

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,32 @@ Aggregation Commands
4141

4242
- The following limitations apply:
4343

44-
* {+adl+} supports only the ``explain``, ``cursor``, and ``comment``
45-
options. For the ``comment`` option, {+adl+} supports only type
46-
``string``.
47-
* {+adl+} supports :pipeline:`$geoNear` and :pipeline:`$graphLookup`
48-
:manual:`aggregation pipeline stages
49-
</reference/operator/aggregation-pipeline>` in queries on {+dl+}
50-
collections that are mapped to one |service| collection only.
51-
{+adl+} doesn't support these :manual:`aggregation pipeline
52-
stages </reference/operator/aggregation-pipeline>` for:
44+
* {+adl+} supports the ``explain``, ``cursor``, ``comment``,
45+
and ``background`` options only. For the ``comment`` option,
46+
{+adl+} supports only type ``string``. {+adl+} supports
47+
``{"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
51+
:ref:`$out Options <adl-out-stage-options>` for more
52+
information.
53+
* {+adl+} supports :pipeline:`$geoNear` and
54+
:pipeline:`$graphLookup` :manual:`aggregation pipeline stages
55+
</reference/operator/aggregation-pipeline>` in queries on
56+
{+dl+} collections that are mapped to one |service| collection
57+
only. {+adl+} doesn't support these :manual:`aggregation
58+
pipeline stages </reference/operator/aggregation-pipeline>`
59+
for:
5360

5461
- |s3| or |http| {+data-lake-stores+}.
55-
- Queries on {+dl+} collections that are mapped to multiple |service|
56-
collections.
62+
- Queries on {+dl+} collections that are mapped to multiple
63+
|service| collections.
5764

5865
See :ref:`query-atlas` for more information.
5966
* {+adl+} Doesn't support the ``$collStats``, ``$indexStats``,
60-
``$listLocalSessions``, and ``$listSessions`` :manual:`aggregation
61-
pipeline stages </reference/operator/aggregation-pipeline>`.
67+
``$listLocalSessions``, and ``$listSessions``
68+
:manual:`aggregation pipeline stages
69+
</reference/operator/aggregation-pipeline>`.
6270

6371
* - :manual:`count </reference/command/count>`
6472

0 commit comments

Comments
 (0)