Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!