I was looking at the Firebase documentation and saw that you can increment a data in the database with the following line:
Database.database().reference().child("Post").setValue([
"number" : ServerValue.increment(10)
])
It also says on the documentation that "the increment operation occurs directly on the database server", I don't really understand what that means. What is the difference between this operation and an operation like :
// We have previously retrieved the value of number which we have stored in a variable
Database.database().reference().child("Post").setValue([
"number" : numberOldValue + 10
])