1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Firebase Security Rules の制約「リクエストあたり評価される式の最大数」の「式」のカウント方式について

Posted at

Firebase Security Rules にはいくつかの制約がある。
それらは公式ドキュメントのこの箇所に書かれている。

このうち、「リクエストあたり評価される式の最大数」の「式」のカウントの仕方について、
Googleの人がStack Overflowで解答していた。

書かれているカウント例を抜粋すると、

true は 1
true || false は 1 (左の true だけカウントされるらしい。)
false || false は 3
request.resource.data は 3
関数呼び出し は 1

らしい。

なるほど、変数や || などもカウント対象なのね。

余談:調べるまでの経緯

XcodeのシミュレータとFirebaseのエミュレータを使って開発している時、Firestoreへの保存時にエラーが発生した。エラー変数をXcodeに表示すると、以下のようであった。

Unable to evaluate the expression as the maximum of 1000 expressions to evaluate has been reached.

何かの制約に引っかかったらしい。
という訳で、調べてみた。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?