I am new to mongodb and I am trying out the document validators that the database itself provides. Here is the command that I have written
db.runCommand({
collMod: "admin",
validator: {
$or : [
{ isActive : { $type : "bool" }},
],
$and: [
{ name : { $type : "string" }},
{ mobileNumber : { $type : "int" }},
]
},
validationAction: "error",
validationLevel: "strict"
});
So it executed perfectly and I can see it in getCollectionInfo
command but now I want to delete this rule but I can't find the method to do it anywhere.
How do I delete this ? Also is there any method which can apply validators to collection which exists as well as non existing collections ?
To remove a certain data validation rule, select any cell with that rule, open the Data Validation dialog window, check the Apply these changes to all other cells with the same settings box, and then click the Clear All button.
It's possible to activate or deactivate validation rules before migration to Salesforce on both Salesforce Classic and Lightning Experience platforms. Note: Available in Essentials, Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions.
Select the node of the required validation. The Change Validation: <Validation Name> (Header data) screen appears. Choose Validation Delete . A dialog box appears, asking if you want to delete the validation.
You should be able to do this by setting the validation level to off
db.runCommand({
collMod: "admin",
validator: {},
validationLevel: "off"
})
Where collMod
is the name of your collection
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With