I'm new to Firestore and it's security rules. For my project, I have some simple rules for data validation that looks like this:
match /users/{userId} {
allow create, update: if
request.resource.data.name is string &&
request.resource.data.age is int &&
request.resource.data.score is int;
}
At the moment I have only tested it on the simulator and it works fine in terms of validating the data, but the problem is for each query I have to provide data for all fields/keys mentioned in the rules. For example, if I want to update the name of the user, I also need to provide the age and score data.
How should I structure my rules so it's possible to update only one specific field without providing data for the other fields?