Hi,
everyone, this is Ameer Hamza Khan, currently, I am modifying a validation for the collection and the code is given below which shows an error "no such command: ‘mode’ ",
db.runCommand({
mode: 'collection',
validator:{
$jsonSchema: {
required: ['name', 'price', 'authors'],
properties: {
name: {
bsonType: 'string',
description: 'must be a string and required'
},
price: {
bsonType: 'number',
description: 'must be a number and required'
},
authors: {
bsonType: 'array',
description: 'must be array and required',
items: {
bsonType: 'object',
required: ['name', 'email'],
properties: {
name:{
bsonType: 'string'
},
email: {
bsonType: 'string'
}
}
}
}
}
}
},
validationAction: 'error'
});
please help me out how to resolve this error what is the correct syntax for mode?
Kind Regards!
Ameer Hamza Khan