Firestore Collection Group Permission

Jul 27, 2021

If you are using Firestore Collection Group, you need to specifiy special rules for the permission.

Indexed

I store data in blog/post, where I want to allow query across post using the following composite index

Collection ID: post Fields indexed: processed Ascending date Descending Query scope: Collection group

Query via collection group

let query = db.collectionGroup('post').where('processed', '==', false).orderBy('date', 'desc').limit(100)

Firestore Rules

  // collection group
  match /{path=**}/post/{postId} {
    allow read: if true;
  }

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.