Firestore security rules: How to validate that a field is undefined?
Use the in
operator to find out if a property of an object doesn't exist.
!("role" in request.resource.data)
This yields a boolean. See it in the rules API docs for the Map type.