{
$jsonSchema: {
bsonType: "object",
required: ["firstName", "lastName", "email", "destination"],
properties: {
firstName: {
bsonType: "string",
description: "First name is required!"
},
lastName: {
bsonType: "string",
description: "Last name is required!"
},
email: {
bsonType: "string",
pattern: "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$",
description: "Email is required"
},
destination: {
bsonType: "string",
description: "Destination is require!"
}
}
}
}
In the above $jsonSchema
, I attempt to use pattern as part of the schema specification
However, me existing ✉️ data fails validation inside of Compass.
This same pattern works just fine on client-side ReactJS form validation, so IK that the pattern itself is good.
However, something must be amiss with how we use this in $jsonSchema
.