All of the examples of JSON schema validation I have found use the following snippet’s format:
db.createCollection("users", {
validator: {
$jsonSchema: {
bsonType: "object",
required: [ "username", "password" ],
properties: {
username: {
bsonType: "string",
description: "must be a string and is required"
},
password: {
bsonType: "string",
minLength: 8,
description: "must be a string at least 8 characters long, and is required"
}
}
}
}
} )
If I want the validation to use a schema.JSON file stored within the same Atlas’ collection, what is the syntax to compare adherence to this separate schema file, after the opening ’ $jsonSchema: {…'?
Thank you for helping a noob JSON schema user.