Database record that is globally writable but can't be deleted?

17 views
Skip to first unread message

Colin McDonnell

unread,
Jul 29, 2016, 10:49:45 AM7/29/16
to Firebase Google Group
Hi,

I have a part of my database that is written to by all users, with all new writes being vetted by validation rules. However I don't want users to be able to delete the record. Is this possible?

Colin

Ron Royston

unread,
Aug 1, 2016, 1:12:27 PM8/1/16
to Firebase Google Group

Since newData merges existing data and new data, it behaves properly even for "partial" updates. For example:
var fredRef = firebase.database().ref("users/fred");
// Valid since we have a name and age.
fredRef
.set({ name: "Fred", age: 19 });
// Valid since we are updating the name but there's already an age.
fredRef
.child("age").set(27);
// Invalid since the .validate rule will no longer be true.
fredRef
.child("name").remove();
Reply all
Reply to author
Forward
0 new messages