2

I'm building create, update and delete operations in my app that uses Firebase. Regarding this answer on a question about the difference between set() and update(), @jmk2142 suggested that creating, updating and deleting an item in firebase could all be done with update().

Apart from semantics / understanding the purpose of the code, is there any good reason NOT to use update() for all of these?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Sventies
  • 2,314
  • 1
  • 28
  • 44

1 Answers1

8

If you want to replace the entire value in a location, you'll want to use set().

If you want to update specific properties or paths under a location, use update().

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807