I am intending to run the following command in Mongo Shell on my Collection once I have it perfected. However, I cannot figure out how to handle the last item in my required properties list, because it's the only one that is an array. It's an array of strings, to be specific. It's the last item, the imageIDs property. I put enum but I don't think that's right. How can I require its type to be an array of strings?
db.runCommand( {
collMod: "CustomerOrders",
validator: { $jsonSchema: {
bsonType: "object",
required: [ "dateTime", "restaurantName", "restaurantCity", "restaurantCountry", "contactName", "contactPhone", "contactEmail", "menuSize", "pricePaid", "currentLanguage", "targetLanguage", "imageIDs" ],
properties: {
dateTime: {
bsonType: "string",
description: "must be a string and is required"
},
restaurantName: {
bsonType: "string",
description: "must be a string and is required"
},
restaurantCity: {
bsonType: "string",
description: "must be a string and is required"
},
restaurantCountry: {
bsonType: "string",
description: "must be a string and is required"
},
contactName: {
bsonType: "string",
description: "must be a string and is required"
},
contactPhone: {
bsonType: "string",
description: "must be a string and is required"
},
contactEmail: {
bsonType: "string",
description: "must be a string and is required"
},
menuSize: {
bsonType: "string",
description: "must be a string and is required"
},
pricePaid: {
bsonType: "double",
description: "must be a string and is required"
},
currentLanguage: {
bsonType: "string",
description: "must be a string and is required"
},
targetLanguage: {
bsonType: "string",
description: "must be a string and is required"
},
imageIDs: {
bsonType: "enum",
description: "can only be one of the enum values and is required"
}
}
} },
validationLevel: "strict"
} )