Skip to content

Commit 5437bc4

Browse files
jason-price-mongodbjason-price-mongodb
and
jason-price-mongodb
authored
DOCSP-27736-sql-error (#5889) (#5946)
* DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error * DOCSP-27736-sql-error --------- Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
1 parent cbe2c09 commit 5437bc4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

source/reference/operator/aggregation/lookup.txt

+18-7
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,25 @@ The :pipeline:`$lookup` takes a document with these fields:
107107
already exists in the input document, the existing field is
108108
*overwritten*.
109109

110-
The operation would correspond to the following pseudo-SQL statement:
110+
The operation corresponds to this pseudo-SQL statement:
111111

112112
.. code-block:: sql
113+
:copyable: false
113114

114-
SELECT *, <output array field>
115-
FROM collection
116-
WHERE <output array field> IN (
117-
SELECT *
115+
SELECT *, (
116+
SELECT ARRAY_AGG(*)
118117
FROM <collection to join>
119118
WHERE <foreignField> = <collection.localField>
120-
);
119+
) AS <output array field>
120+
FROM collection;
121121

122-
See these examples:
122+
.. note::
123+
124+
The SQL statements on this page are included for comparison to the
125+
MongoDB aggregation pipeline syntax. The SQL statements aren't
126+
runnable.
127+
128+
For MongoDB examples, see these pages:
123129

124130
- :ref:`lookup-single-equality-example`
125131
- :ref:`unwind-example`
@@ -230,6 +236,7 @@ The :pipeline:`$lookup` stage accepts a document with these fields:
230236
The operation corresponds to this pseudo-SQL statement:
231237

232238
.. code-block:: sql
239+
:copyable: false
233240

234241
SELECT *, <output array field>
235242
FROM collection
@@ -355,6 +362,7 @@ The :pipeline:`$lookup` accepts a document with these fields:
355362
The operation corresponds to this pseudo-SQL statement:
356363

357364
.. code-block:: sql
365+
:copyable: false
358366

359367
SELECT *, <output array field>
360368
FROM localCollection
@@ -619,6 +627,7 @@ The operation returns these documents:
619627
The operation corresponds to this pseudo-SQL statement:
620628

621629
.. code-block:: sql
630+
:copyable: false
622631

623632
SELECT *, inventory_docs
624633
FROM orders
@@ -880,6 +889,7 @@ The operation returns these documents:
880889
The operation corresponds to this pseudo-SQL statement:
881890

882891
.. code-block:: sql
892+
:copyable: false
883893

884894
SELECT *, stockdata
885895
FROM orders
@@ -995,6 +1005,7 @@ The operation returns the following:
9951005
The operation corresponds to this pseudo-SQL statement:
9961006

9971007
.. code-block:: sql
1008+
:copyable: false
9981009

9991010
SELECT *, holidays
10001011
FROM absences

0 commit comments

Comments
 (0)