service cloud.firestore {
match /databases/{database}/documents {
// Make sure the uid of the requesting user matches name of the user
// document. The wildcard expression {userId} makes the userId variable
allow read, update, delete: if request.auth.uid == userId;
allow create: if request.auth.uid != null;