I was using Realtime Database and am now migrating to use Firestore. Previously, I was storing my providerData
as an array, since one account can have multiple providers assigned. Right now, I'm trying to keep the same structure for Firestore, but it doesn't store the providerData
object inside the array.
I saw some comments on how Firestore doesn't allow custom objects and already transformed the Firebase object into Javascript pure object.
My profileFactory is currently like this:
profileFactory: (data, profile) => {
const helperProviderData = (profile.providerData || data.providerData || data.user.providerData);
const providerData = JSON.parse(JSON.stringify(helperProviderData));
return ({
...profile,
role: 'user',
providerData,
test: providerData[0],
});
}
On Firestore, I have the test
field correctly populated, but the providerData
field is set as an Array with one empty Object.
These are the versions:
"@firebase/app": "0.4.19",
"@firebase/auth": "0.12.1",
"@firebase/database": "0.5.7",
"@firebase/firestore": "1.6.1",
"react-redux-firebase": "^3.0.2",
"redux-firestore": "^0.11.0",
Is it possible to set as an Array of providers or I'll need to create a provider field for each provider accepted by my app?