[SERVER-72941] Use compact diff format for updates to arrays using classic $addToSet operator Created: 17/Jan/23  Updated: 29/Oct/23  Resolved: 11/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Katya Kamenieva Assignee: Mickey Winters
Resolution: Fixed Votes: 0
Labels: query-product-scope-1, query-product-urgency-2, query-product-value-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-16484 Optimize $addToSet oplog generation w... Closed
Related
related to SERVER-71269 Use compact diff format for updates t... Backlog
is related to DOCS-16424 [SERVER] Describe what to expect from... Backlog
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-05-15, QE 2023-05-29, QE 2023-06-12, QE 2023-06-26, QE 2023-07-10, QE 2023-07-24, QE 2023-08-07, QE 2023-08-21
Participants:

 Description   

When we use $addToSet to add an element to the array, the entire new array is recorded in the oplog. This leads to large change stream events.

Today $addToSet does not guarantee a particular ordering of elements in the modified set, so it could be modified to always add the element to the end of the array, similar to $push, and produce message like { 'arrayField.100': 'value'  }



 Comments   
Comment by Ian Ward [ 11/Aug/23 ]

Amazing! 

Comment by Katya Kamenieva [ 11/Aug/23 ]

🎉

Comment by Githook User [ 10/Aug/23 ]

Author:

{'name': 'Mickey. J Winters', 'email': 'mickey.winters@mongodb.com', 'username': 'mjrb'}

Message: SERVER-72941: use compact diff format for updates to arrays using classic $addToSet operator
Branch: master
https://github.com/mongodb/mongo/commit/188f9ed7511485f26614ec590e42db1d8f20eca2

Generated at Thu Feb 08 06:23:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.