Toshiya Miyagi
 · Swim, bike, run, and develop!

Firestore Collection Group in FlutterFlow

Resolved

Hi, all.

Can someone please tell me how to use Firestore Collection Group in FlutterFlow?

In my SNS application, users can post "public" or "private" content. The "public" content is visible to everyone on the timeline page and is also searchable in the search page.
Search page is using Algolia. "Private" content can only be viewed by users on his/her own content pages.

I have come up with three ways to achieve this.

1. One Collection with Visibility as a Field

"Private" documents can be protected by Firestore security rules. I liked this method because it was simple and clear, but decided to reject this approach for the following reasons.

  • Since all "userContent" documents are synchronized to Algolia, a special configuration is needed to protect "private" documents from the search page. This configuration is unclear to maintain and does not eliminate the risk of accidentally publishing while procedure during maintenance.

  • The above setting is specific to Algolia and severely impair search server substitutability.

2. In addition to a collection that stores all (Public and Private)user content, duplicate "Public" content to another public collection.

This method is OK, but I want to save more document volume and write count waste. So next method.

3. Create separate collections for public and private content

On his or her own content page, he or she gets both private and public content. I think the proper Firestore way for this purpose to use Collection Group, but the FlutterFlow documents does not describe how to use them. If you know how to use it except APIs and Cloud Function, could you please let me know?

Thanks!

1