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

266
Visualizações
Firestore duplicate verification conditions

My Firestore database looks like this

enter image description here

For documents I use dynamic IDs. I do not use the user ID in the path, it is stored in the field. The fields have the values user and active.

How can I prevent adding new entries if, for example, the user 37870283 already has an active = true?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is no way to ensure the uniqueness of a field value in Firestore security rules. The only ways to ensure uniqueness are:

  1. Use the thing that needs to be unique as the document ID.
  2. Perform all writes from a single, trusted process (like Cloud Functions), and use transactions there.

Also see:

  • Cloud Firestore: Enforcing Unique User Names
  • Prevent duplicate entries in Firestore rules not working
  • Firestore security rule to check if character username already exists

And more from this list

about 4 years ago · Juan Pablo Isaza 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