@@ -107,19 +107,25 @@ The :pipeline:`$lookup` takes a document with these fields:
107
107
already exists in the input document, the existing field is
108
108
*overwritten*.
109
109
110
- The operation would correspond to the following pseudo-SQL statement:
110
+ The operation corresponds to this pseudo-SQL statement:
111
111
112
112
.. code-block:: sql
113
+ :copyable: false
113
114
114
- SELECT *, <output array field>
115
- FROM collection
116
- WHERE <output array field> IN (
117
- SELECT *
115
+ SELECT *, (
116
+ SELECT ARRAY_AGG(*)
118
117
FROM <collection to join>
119
118
WHERE <foreignField> = <collection.localField>
120
- );
119
+ ) AS <output array field>
120
+ FROM collection;
121
121
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:
123
129
124
130
- :ref:`lookup-single-equality-example`
125
131
- :ref:`unwind-example`
@@ -230,6 +236,7 @@ The :pipeline:`$lookup` stage accepts a document with these fields:
230
236
The operation corresponds to this pseudo-SQL statement:
231
237
232
238
.. code-block:: sql
239
+ :copyable: false
233
240
234
241
SELECT *, <output array field>
235
242
FROM collection
@@ -355,6 +362,7 @@ The :pipeline:`$lookup` accepts a document with these fields:
355
362
The operation corresponds to this pseudo-SQL statement:
356
363
357
364
.. code-block:: sql
365
+ :copyable: false
358
366
359
367
SELECT *, <output array field>
360
368
FROM localCollection
@@ -619,6 +627,7 @@ The operation returns these documents:
619
627
The operation corresponds to this pseudo-SQL statement:
620
628
621
629
.. code-block:: sql
630
+ :copyable: false
622
631
623
632
SELECT *, inventory_docs
624
633
FROM orders
@@ -880,6 +889,7 @@ The operation returns these documents:
880
889
The operation corresponds to this pseudo-SQL statement:
881
890
882
891
.. code-block:: sql
892
+ :copyable: false
883
893
884
894
SELECT *, stockdata
885
895
FROM orders
@@ -995,6 +1005,7 @@ The operation returns the following:
995
1005
The operation corresponds to this pseudo-SQL statement:
996
1006
997
1007
.. code-block:: sql
1008
+ :copyable: false
998
1009
999
1010
SELECT *, holidays
1000
1011
FROM absences
0 commit comments