'Problem with Firestore Security Rules based on array attribute

I have a collection forms in Firestore with 2 documents as below: Document 1

Document 2

My Firestore security rules look like below: Firestore Rules

However, when I try a query like below,

    const q1 = query(
      collection(this.fs, 'forms'),
      where('createdBy', '==', this.auth.currentUser.uid)
    );
    collectionData(q1).subscribe((data) => {
      console.log(data);
    }, (error) => {
      console.error(error);
    }, () => {
    });    

I get the following error:

FirebaseError: Missing or insufficient permissions.

Can anybody suggest, what am I doing incorrectly.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source