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

Validator fails for optional property "r"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.3.1
    • Component/s: None
    • None
    • ALL
    • Hide

      Create a collection with that validator, and try to insert a document without the property "r".

       

      I am using the Node.js driver in case that is important.

      Show
      Create a collection with that validator, and try to insert a document without the property "r".   I am using the Node.js driver in case that is important.

      I am using this validator:

      {{{}}
        $jsonSchema: {
          bsonType: 'object',
          additionalProperties: true,
          properties: {
            r: {
              bsonType: 'string',
            },
          },
        },
      }

       

      This validator should allow me to insert a document that doesn't have the property "r", but when I try to insert a document without this property it fails.

       

      However, if I change the "r" field to "ref", then I can insert documents without the "ref" field.

            Assignee:
            yuan.fang@mongodb.com Yuan Fang
            Reporter:
            zachsmith.sa@gmail.com Zachary Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: