3

I am pretty to new to Firebase and was trying to port my existing app to firebase backend. Now, when I am inserting a bunch of records, I want to first check if the record is already there in the backend. How do I do that? The Query, class gives orderby() and equalto() functions, but that makes inserting records very cumbersome as I will have to check if the record is there, that too asynchronously. Is there a better way?

Codevalley
  • 4,593
  • 7
  • 42
  • 56
  • You'll (also) want to do this in security rules, to prevent race conditions. See http://stackoverflow.com/questions/20260476/what-firebase-rule-will-prevent-duplicates-in-a-collection-based-on-other-fields – Frank van Puffelen May 26 '16 at 14:04

0 Answers0