Fire Beast

One hidden but handy Firestore security rules feature

If you want to check which fields have updated in Firestore security rules you can use request.writeFields:

match /invitations/{invitationId} {
  allow update: if request.writeFields.hasOnly(['acceptKey', 'state', 'acceptedAt'])
    && == 'accepted'
    && ==
    && is request.time

  // Other rules...

However, there're a few problems with it!

First of all, it works only for allow update.

Secondly, it includes all fields that were included in the update request, even if the passed values are equal to the current ones.

Because of these two problems Firebase the Firebase team decided to deprecate it and promised to come up with a better solution but as of 31 January 2020, there's still no replacement for it.

Lastly, it doesn't work in the simulator.

So, if you understand its limitations and ready to sacrifice the simulator, feel free to use.