Firebase - Arrays
This chapter will explain the Firebase representation of arrays. We will use the same data from the previous chapter.
We could create this data by sending the following JSON tree to the player’s collection.
This is because Firebase does not support Arrays directly, but it creates a list of objects with integers as key names.
The reason for not using arrays is because Firebase acts as a real time database and if a couple of users were to manipulate arrays at the same time, the result could be problematic since array indexes are constantly changing.
The way Firebase handles it, the keys (indexes) will always stay the same. We could delete john and amanda would still have the key (index) 1.