
- Firebase - Home
- Firebase - Overview
- Firebase - Environment Setup
- Firebase - Data
- Firebase - Arrays
- Firebase - Write Data
- Firebase - Write List Data
- Firebase - Write Transactional Data
- Firebase - Read Data
- Firebase - Event Types
- Firebase - Detaching Callbacks
- Firebase - Queries
- Firebase - Filtering Data
- Firebase - Best Practices
- Firebase - Email Authentication
- Firebase - Google Authentication
- Firebase - Facebook Authentication
- Firebase - Twitter Authentication
- Firebase - Github Authentication
- Anonymous Authentication
- Firebase - Offline Capabilities
- Firebase - Security
- Firebase - Deploying
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 players collection.
['john', 'amanda']
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.

Advertisements