As I mentioned in the comments (took this from the documentation ):
. , . .
, , .write:false node . , :
{
"rules": {
".read": false,
"messages": {
".read": true,
"$message": {
".write": "auth != null",
".validate": "newData.hasChildren(['createdAt', 'text', 'user'])",
"createdAt": { ".validate": "newData.val() == now" },
"text": { ".validate": "newData.isString() && newData.val().length > 0" },
"user": {
".validate": "newData.hasChildren(['_id', 'name'])",
"_id": { ".validate": "newData.val() == auth.uid" },
"name": { ".validate": "newData.val() == auth.token.name" },
"$other": { ".validate": false }
},
"$other": { ".validate": false }
}
}
}
}
auth.token.name. " " , :
{
"provider": "anonymous",
"uid": "N4EbtSX5HbM9JLjsW6hWT3NWzAx1"
}
, name, auth.token.name null, .
, "" "", , :
{
"provider": "anonymous",
"uid": "N4EbtSX5HbM9JLjsW6hWT3NWzAx1",
"token":{
"name": "Mike"
}
}
, , , :
{
"createdAt": {
".sv": "timestamp"
},
"text": "Test 1",
"user":
{
"_id": "48c83bf9-7354-4720-838f-8b68e0addd51",
"name": "Mike"
}
}