db.createCollection("persons", {
   validator: {
      $jsonSchema: {
         bsonType: "object",
         required: [ "name", "dob" ],
         properties: {
            name: {
               bsonType: "string",
               description: "should be a string and is required"
            },
            gender: {
               bsonType: "string",
               description: "should be a string and is not required"
            },
            dob: {
               bsonType: "int",
               minimum: 2017,
               maximum: 3017,
               exclusiveMaximum: false,
               description: "should be an integer in [ 2017, 3017 ] and is required"
            }
         }
      }
   }
})