Home > Mobile >  Function not found when converting string to boolean in Firestore security rules
Function not found when converting string to boolean in Firestore security rules

Time:05-07

I'm writing a error on the firebase console

Is this a bug on Firebase or am I doing something wrong here?

CodePudding user response:

firebaser here

I checked with our engineering team who looked at the code for this part of the rules engine, and this may have been some wishful thinking on the part of the writer of that documentation: no built-in bool function exists.

The good news is that you can define a function like that yourself with:

function bool(str) {
  return str == "true" ? true : (str == "false" ? false : null);
}

We'll get the docs updated to either include this definition or to remove the mention of the bool function altogether.

  • Related