[SERVER-48779] Implement skeleton of MatchExpressionVisitor to be used for generating document validation errors Created: 15/Jun/20  Updated: 29/Oct/23  Resolved: 25/Jun/20

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

Type: Task Priority: Major - P3
Reporter: Mihai Andrei Assignee: Mihai Andrei
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Query 2020-06-15, Query 2020-06-29
Participants:

 Description   

This ticket will introduce three visitor types which derive from ‘MatchExpressionVisitor’, each of which have different responsibilities during error generation:

  • ValidationErrorPreVisitor: This type will be responsible for generating errors, where each implementation of visit() will generate an error for a MatchExpression of that type. The implementations of non-leaf MatchExpressions will also allocate either a BSONObjBuilder or a BSONArrayBuilder for its children to use when generating an error.
  • ValidationErrorInVisitor: This type will only have real implementations of visit() for non-leaf MatchExpressions, where each implementation is responsible for maintaining any state between visits to their children. For instance, if the current child of a ListOfMatchExpression finishes generating an error, visit() will need to add that error to the list of errors that is being tracked and create a new BSONObjBuilder for the next child error.
  • ValidationErrorPostVisitor: This type will do any work needed to wrap up generating an error for the current node.

In addition to the three visitor types above, a ValidationErrorContext type will be introduced which tracks any runtime information needed by each of the visitors to produce a sensible error.



 Comments   
Comment by Githook User [ 25/Jun/20 ]

Author:

{'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}

Message: SERVER-48779 Implement skeleton of MatchExpressionVisitor to be used for generating document validation errors
Branch: master
https://github.com/mongodb/mongo/commit/28e0f60b7b61bf31d41839f6633ef5736712af9a

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