Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-48779

Implement skeleton of MatchExpressionVisitor to be used for generating document validation errors

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • Query 2020-06-15, Query 2020-06-29

      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.

            Assignee:
            mihai.andrei@mongodb.com Mihai Andrei
            Reporter:
            mihai.andrei@mongodb.com Mihai Andrei
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: