by execution of firestore runTransaction function on the web, it occurs error below.
firestore.googleapis.com/v1beta1/projects/myproject/databases/(default)/documents:commit:1 POST https://firestore.googleapis.com/v1beta1/projects/myproject/databases/(default)/documents:commit 403
i want to allow only update one field for everyone and others are for login user.
so update rule uses next.
allow update: if request.resource.data.keys().hasOnly(["numPlayed"])
|| request.auth.uid != null;
and transaction codes like
this.db.runTransaction(function(t) {
return t.get(pubRef)
.then(function(pub) {
var numPlayed = pub.data().numPlayed + 1;
t.update(pubRef, { numPlayed: numPlayed });
return numPlayed;
});
})
why it occurs error?