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

Type mismatches in jsonSchema should only be reported by the 'type' or 'bsonType' keyword

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query 2020-10-05, Query 2020-10-19, Query 2020-11-02

      Suppose the validator expression {$jsonSchema: {properties: {a: {type: 'string', minLength: 2}}} fails to match against the document {a: 1}. The generated error will report that there is a type mismatch twice: once for the 'type' keyword and once for the 'minLength' keyword. Ideally, the 'minLength' keyword (or generally speaking, any such scalar keyword) should not produce a type mismatch error since the semantics of these jsonSchema scalar keywords is to fail to match if the instance matches the expected type.

            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: