Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
How can I delete the validation rule appiled to my collection?

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 ?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

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

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda