Skip to content

Commit 5e35b5a

Browse files
kallimachoskay-kim
authored andcommitted
DOCS-11037 Describe $out stage process
1 parent 9c6d374 commit 5e35b5a

File tree

1 file changed

+8
-9
lines changed
  • source/reference/operator/aggregation

1 file changed

+8
-9
lines changed

source/reference/operator/aggregation/out.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ Replace Existing Collection
6767

6868
If the collection specified by the :pipeline:`$out` operation already
6969
exists, then upon completion of the aggregation, the :pipeline:`$out`
70-
stage atomically replaces the existing collection with the new
71-
results collection using the following process:
72-
73-
#. A temp collection is created.
74-
#. Indexes are copied from the destination collection to the temp collection.
75-
#. Documents are inserted into the temp collection.
76-
#. The temp collection calls `renameCollection
77-
<https://docs.mongodb.com/manual/reference/method/db.collection.renameCollection/>`__,
78-
providing the name of the destination collection and ``dropTarget: true``.
70+
stage atomically replaces the existing collection with the new results
71+
collection. Specifically, the :pipeline:`$out` operation:
72+
73+
#. Creates a temp collection.
74+
#. Copies the indexes from the existing collection to the temp collection.
75+
#. Inserts the documents into the temp collection.
76+
#. Calls :method:`db.collection.renameCollection` with ``dropTarget: true``
77+
to rename the temp collection to the destination collection.
7978

8079
The :pipeline:`$out` operation does not change any indexes that existed on the
8180
previous collection. If the aggregation fails, the :pipeline:`$out` operation

0 commit comments

Comments
 (0)