Closed WhatsThatItsPat closed 7 years ago
While possible, I don't think this leads to a clear/maintainable rules file, besides :
is an allowed key as well as _
or most other characters other than what is documented here: https://firebase.google.com/docs/database/web/structure-data#how_data_is_structured_its_a_json_tree
With flat data structures / denormalization in mind, I use a variation of dot notation for higher detail collections. But in Firebase, dots are reserved and can't be in node keys, so I use the colon.
So instead of:
I flatten it to:
I like this organizational practice and it makes the database in the FB console look pretty. The one slight annoyance in Bolt is that the colons force me to use bracket notation to access the flattened collections:
Would it be possible to allow the colon (and other non-reserved characters) to be treated as
\w
characters so dot notation could be used for property access? Then we could do:The colon presents no issues in path declarations:
It would be nice to look at my Bolt file and immediately know that in any brackets I am intentionally creating a string from variables, instead of taking a second to see if I'm just escaping one of my colon separators.
I'm considering switching to the underscore as my separator, but that conflicts with other uses for the underscore.