Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions source/reference/operator/rename.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,22 @@ $rename
Before version 2.2, when renaming multiple fields and only some (but
not all) old field names refer to non-existing fields:

- **if** no field exists with the new field name, the
:operator:`$rename` operator does nothing.
- For the fields with the old names that do exist, the
:operator:`$rename` operator renames these fields to the
specified new field names.

- For the fields with the old names that do **not** exist:

- **if** no field exists with the new field name, the
:operator:`$rename` operator does nothing.

- **if** fields already exist with the new field names, the
:operator:`$rename` operator drops these fields.
- **if** fields already exist with the new field names, the
:operator:`$rename` operator drops these fields.

Consider the following operation that renames both the
field ``mobile``, which exists, the field ``wife``, which
does not exist. The operation will set the
field named ``wife`` ``alias``, which is the name of an
existing field:
Consider the following operation that renames both the field
``mobile``, which exists, and the field ``wife``, which does
not exist. The operation tries to set the field named ``wife``
to ``alias``, which is the name of an existing field:

.. code-block:: javascript

Expand Down