[SERVER-28763] Create UpdateArrayNode Created: 12/Apr/17  Updated: 12/Oct/17  Resolved: 14/Jun/17

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Task Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Tess Avitabile (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-28757 Create BSONElementViewMatchableDocument Closed
depends on SERVER-28758 Implement UpdateNode::mergeTrees() Closed
is depended on by SERVER-28779 Allow $[] syntax for specifying array... Backlog
is depended on by SERVER-28777 Always parse update expression as an ... Closed
is depended on by SERVER-28778 Multiversion testing for array updates Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2017-05-29, Query 2017-06-19
Participants:

 Description   

Create UpdateArrayNode and implement all methods. Include UpdateArrayNode in parsing and UpdateNode::mergeTrees().

Notes on parsing:

  • We fail to parse if we try to make an UpdateArrayNode in the same position as a node of a different type.
  • Each <id> used in an array update must have an arrayFilter and vice versa.

Notes on UpdateNode::mergeTrees():

  • It is an error to merge an UpdateArrayNode with a node of a different type.

Notes on UpdateArrayNode::apply():

  • We require that pathToCreate be empty and element be an array (i.e. the array existed in the document prior to update). For each element of the array, use the arrayFilters to determine the set of children to apply to the element. If only one child matches, call apply() on that child. If multiple children match, clone and merge the children, and call apply() on the result. The merged set of children should be stored and reused for other array elements and other documents.
  • indexesAffected and noop are computed by OR-ing and AND-ing the results of the children, respectively.
  • First apply the array filters to determine how many elements are matched. Then if only one element was matched, pass logBuilder on to the child when calling apply(). Otherwise, do not pass the logBuilder on to the children when calling apply(). If multiple children were modified (not noops), record the entire array as a $set. If one element was modified, record that element as a $set. If no elements were modified, do not write to logBuilder.


 Comments   
Comment by Githook User [ 14/Jun/17 ]

Author:

{u'username': u'tessavitabile', u'name': u'Tess Avitabile', u'email': u'tess.avitabile@mongodb.com'}

Message: SERVER-28763 Create UpdateArrayNode
Branch: master
https://github.com/mongodb/mongo/commit/676206d10e8a626e9c5e39045468dbe0bb2bd75a

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