Here's my database:
{
"lists": {
"list1_id_1": {
"field1": "some value",
"field2": "some value"
}
}
}
I want to allow any user to create new lists, but not modify existing ones, so I tried the following rules:
{
"rules": {
"lists": {
".read": "true",
".write": "!data.exists()"
}
}
}
This didn't work when I tried to write the following data to /lists/:
{ "field1": "qq", "field2": "ww" }
Apparently, the ".write" rule failed the write because /lists/ already exists.
So I tried the following rules:
{
"rules": {
"lists": {
".read": "true",
"$list_id": {
".write": "!data.exists()"
}
}
}
}
This didn't work either, Firebase simulator didn't select the rule which failed the write operation, so I guess it's because the ".write" is missing from "lists".
Could you please help me out here? I think my problem is with both the rules, and the way I tried to push a new item to /lists/ in the simulator.
P.S. I know the list_id will be generated by Firebase when I try to push new data, but I'm not sure how to use this knowledge for the simulator.
Thanks! Slavik
