Firebase realtime database validate child object in array
up vote
1
down vote
favorite
Trying to validate that an array value only contains certain elements.
The "focus" key, should only contain any or both of the following: "movement", "strength".
So I tried sending this:
{
"focus": ["movement"]
}
... and the security rules:
"$id": {
"focus" : {
".validate": "newData.hasChild('movement') || newData.hasChild('strength') || newData.hasChildren(['strength', 'movement'])"
}
}
But get "Simulated update denied" and cannot understand why.
Thanks in advance
json firebase firebase-realtime-database
add a comment |
up vote
1
down vote
favorite
Trying to validate that an array value only contains certain elements.
The "focus" key, should only contain any or both of the following: "movement", "strength".
So I tried sending this:
{
"focus": ["movement"]
}
... and the security rules:
"$id": {
"focus" : {
".validate": "newData.hasChild('movement') || newData.hasChild('strength') || newData.hasChildren(['strength', 'movement'])"
}
}
But get "Simulated update denied" and cannot understand why.
Thanks in advance
json firebase firebase-realtime-database
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Trying to validate that an array value only contains certain elements.
The "focus" key, should only contain any or both of the following: "movement", "strength".
So I tried sending this:
{
"focus": ["movement"]
}
... and the security rules:
"$id": {
"focus" : {
".validate": "newData.hasChild('movement') || newData.hasChild('strength') || newData.hasChildren(['strength', 'movement'])"
}
}
But get "Simulated update denied" and cannot understand why.
Thanks in advance
json firebase firebase-realtime-database
Trying to validate that an array value only contains certain elements.
The "focus" key, should only contain any or both of the following: "movement", "strength".
So I tried sending this:
{
"focus": ["movement"]
}
... and the security rules:
"$id": {
"focus" : {
".validate": "newData.hasChild('movement') || newData.hasChild('strength') || newData.hasChildren(['strength', 'movement'])"
}
}
But get "Simulated update denied" and cannot understand why.
Thanks in advance
json firebase firebase-realtime-database
json firebase firebase-realtime-database
edited 20 hours ago
PradyumanDixit
1,7291718
1,7291718
asked 22 hours ago
BlackMouse
1,96142552
1,96142552
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237727%2ffirebase-realtime-database-validate-child-object-in-array%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password