[SERVER-48890] allow $addFields with empty document and have it be a no-op Created: 16/Jun/20  Updated: 29/Oct/23  Resolved: 11/Nov/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0, 4.0.25, 4.2.15, 4.4.7

Type: Improvement Priority: Major - P3
Reporter: Asya Kamsky Assignee: Betty Shen (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng, qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-38909 Permit empty update modifiers, treati... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Query 2020-10-19, Query 2020-11-02, Query 2020-11-16
Participants:

 Description   

For programatic populating of $addFields (in update pipeline for instance) it would help if (becoming consistent with SERVER-38909) we would allow empty document rather than error "Invalid $addFields :: caused by :: specification must have at least one field"



 Comments   
Comment by Githook User [ 02/Jun/21 ]

Author:

{'name': 'caiyingshen', 'email': 'caiying.shen526@gmail.com', 'username': 'caiyingshen'}

Message: SERVER-48890: allow addFields to take empty document as no-op

(cherry picked from commit b9b781778f3ccaab0b0fab72efadab55b49f8705)
Branch: v4.0
https://github.com/mongodb/mongo/commit/8b311f78ee7f15cf30f3032edca0ab7403812098

Comment by Githook User [ 02/Jun/21 ]

Author:

{'name': 'caiyingshen', 'email': 'caiying.shen526@gmail.com', 'username': 'caiyingshen'}

Message: SERVER-48890: allow addFields to take empty document as no-op

(cherry picked from commit b9b781778f3ccaab0b0fab72efadab55b49f8705)
Branch: v4.2
https://github.com/mongodb/mongo/commit/f7099031b5c434669b89b253f9ce3606b7139523

Comment by Githook User [ 27/May/21 ]

Author:

{'name': 'caiyingshen', 'email': 'caiying.shen526@gmail.com', 'username': 'caiyingshen'}

Message: SERVER-48890: allow addFields to take empty document as no-op

(cherry picked from commit b9b781778f3ccaab0b0fab72efadab55b49f8705)
Branch: v4.4
https://github.com/mongodb/mongo/commit/dd53f7efa0b21f56188c4c058316c7cbf51bc62e

Comment by Githook User [ 06/Nov/20 ]

Author:

{'name': 'caiyingshen', 'email': 'caiying.shen526@gmail.com', 'username': 'caiyingshen'}

Message: SERVER-48890: allow addFields to take empty document as no-op
Branch: master
https://github.com/mongodb/mongo/commit/b9b781778f3ccaab0b0fab72efadab55b49f8705

Generated at Thu Feb 08 05:18:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.