You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Firestore] - FieldValue.arrayUnion broken on version 11.2.0 #1954
After updating firebase-admin from 10.3.0 to use the new COUNT() feature, I can no longer update a DOC with set() and FieldValue.arrayUnion, even though the property was in the Document previously.
Steps to reproduce:
In version 10.3.0 when I use the code below it works as expected.
// Initializing Firebase in CloudFunctionsconstfunctions=require("firebase-functions"),admin=require('firebase-admin');constIS_EMULATOR=((typeofprocess.env.FUNCTIONS_EMULATOR==='boolean'&&process.env.FUNCTIONS_EMULATOR)||process.env.FUNCTIONS_EMULATOR==='true');admin.initializeApp();letfirestore=admin.firestore();if(IS_EMULATOR){firestore.settings({host: 'localhost',port: '8081',ssl: false})}
I don't know if, between versions 10.3.0 and 11.2.0, the way to call the arrayUnion({}) function changed or if I'm doing something wrong, but since nothing was changed in the code, only the version, I understand that maybe the problem be on the new version, any input is welcome :)
After looking at some other issues that other users were having with Firestore here in the repository and reading this comment from @lahirumaramba, it was enough minor modifications in the way to call the Firestore functions that the problem was solved. The big problem was the switch to modular SDK
Reacted by Guillaume Prevost, Philip Mugabi, Michael Tigas, Atharva Wasekar, JimTeva, Aslam Anver, Nicolas Forno, Aleksandr Sharipov, Osama Ahmed, Tanner King and 1 more
Activity
google-oss-bot commentedon Oct 26, 2022
I found a few problems with this issue:
abMarlim commentedon Oct 27, 2022
After looking at some other issues that other users were having with Firestore here in the repository and reading this comment from @lahirumaramba, it was enough minor modifications in the way to call the Firestore functions that the problem was solved. The big problem was the switch to modular SDK
To resolve:
1) Initialize Firebase in Cloud Functions
2) And when using the Firestore with arrayUnion update function