Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4168

schema validation doesn't work

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Iteration Yak

      compass version 1.20.5

      When I enter the following into compass, I get a parsing error saying unexpected token ':'

      $jsonSchema: {
        {
          bsonType: "object",
          required: ["name"],
          properties: {
            name: {
              bsonType: "string",
              description: "must be a string and is required"
            }
          }
        }
      }
      

      When I enter the following it saves the validator but the validator doesn't work because it doesn't have $jsonSchema notation.

        {
          bsonType: "object",
          required: ["name"],
          properties: {
            name: {
              bsonType: "string",
              description: "must be a string and is required"
            }
          }
        }
      
      MongoDB Enterprise SHARED-DEMO-shard-0:PRIMARY> db.getCollectionInfos()
      [
      	{
      		"name" : "schema_validation",
      		"type" : "collection",
      		"options" : {
      			"validator" : {
      				"bsonType" : "object",
      				"required" : [
      					"name"
      				],
      				"properties" : {
      					"name" : {
      						"bsonType" : "string",
      						"description" : "must be a string and is required"
      					}
      				}
      			},
      			"validationLevel" : "strict",
      			"validationAction" : "error"
      		},
      		"info" : {
      			"readOnly" : false,
      			"uuid" : UUID("7ff90c0b-0569-4974-8dff-d442d6bab910")
      		},
      		"idIndex" : {
      			"v" : 2,
      			"key" : {
      				"_id" : 1
      			},
      			"name" : "_id_",
      			"ns" : "kang.schema_validation"
      		}
      	},
      

      When I manually create the collection using mdb clu with jsonSchema notation for the validator, it works.

            Assignee:
            Unassigned Unassigned
            Reporter:
            eugene.kang@mongodb.com Eugene Kang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: