The picture you show is of the Firebase Realtime Database, yet in your code you're trying to use the firestore.ArrayUnion operator that only exists on Cloud Firestore. While both Realtime Database and Cloud Firestore are part of Firebase, they are completely separate and have different APIs.
There is no equivalent of the ArrayUnion operator for the Realtime Database. In fact, to store this structure on Realtime Database it is more common to do:
The picture you show is of the Firebase Realtime Database, yet in your code you're trying to use the
firestore.ArrayUnionoperator that only exists on Cloud Firestore. While both Realtime Database and Cloud Firestore are part of Firebase, they are completely separate and have different APIs.There is no equivalent of the
ArrayUnionoperator for the Realtime Database. In fact, to store this structure on Realtime Database it is more common to do:With this structure, you can add XXL to it with: