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 }}
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
When this object is initially created wholesale, firebase renders the "events" property as an array, because each key in the array is an int. However, if I were to add an event to the events "array" via a POST to myfirebaseinstance.com/users/0/events.json, the unique key autogenerated by firebase causes ES to now index each child as its own object in the mapping.
but once that POST goes through to add an event to the user's events array, FB stops rendering it as an array and now renders it as an object because the unique key (ex: "-K-ASDAIS"). Now that this is rendered as an object instead of an array, ES updates the mapping to accommodate, and now my mapping went from looking like the above to looking something like this:
Obviously its not scalable to have ES update my mapping every time I add an event to a user's event's array. Also, it breaks my Android client's serialization. The client is expecting an array wheras now it's getting an object.
Is there any way around this? Am I missing something obvious? Or should I not have used Flashlight/Firebase/ES for this particular use case? I'll admit I didn't know about FB's lack of array support until tonight, so part of this is on me. I'm just hoping I can find a workaround rather than having to reimplement my backend from scratch.
The text was updated successfully, but these errors were encountered:
I have an object stored like so in FB:
When this object is initially created wholesale, firebase renders the "events" property as an array, because each key in the array is an int. However, if I were to add an event to the events "array" via a POST to
myfirebaseinstance.com/users/0/events.json
, the unique key autogenerated by firebase causes ES to now index each child as its own object in the mapping.So when I created my mapping in ES, I had
but once that POST goes through to add an event to the user's events array, FB stops rendering it as an array and now renders it as an object because the unique key (ex: "-K-ASDAIS"). Now that this is rendered as an object instead of an array, ES updates the mapping to accommodate, and now my mapping went from looking like the above to looking something like this:
Obviously its not scalable to have ES update my mapping every time I add an event to a user's event's array. Also, it breaks my Android client's serialization. The client is expecting an array wheras now it's getting an object.
Is there any way around this? Am I missing something obvious? Or should I not have used Flashlight/Firebase/ES for this particular use case? I'll admit I didn't know about FB's lack of array support until tonight, so part of this is on me. I'm just hoping I can find a workaround rather than having to reimplement my backend from scratch.
The text was updated successfully, but these errors were encountered: