Hello, first of all, you should forget the logic of working in SQL databases and begin to interpret the instances of the classes in which you work directly, this is the logic of nonrelational document type databases (eg Firebase, MongoDB, MariaDB, etc ...).
When working with this type of database, objects are instantiated directly, depending on their elements. In the case of firebase (which is your choice) it does not allow you to work directly with arrays inside objects, instead it allows you to set the keys for a parent object in an orderly fashion. The result would be something like this:
{
"carros": {
1: { "nome": "carro", "unidades": 1 },
2: { "nome": "carro2", "unidades": 3 },
3: { "nome": "carro3", "unidades": 5 },
}
}
With this structure, you no longer need to keep the table "id" inside the object because it is only a relational index and is no longer a logical reference. In case you need to use it, the firebase allows you to tell it to send the $key
key to your object, which will be identified directly as if it were your "id".
I advise you to start studying Non-SQL because from now on it is the future in relation to the data storage in question at cost / benefit. Even well-used and robust databases like Oracle and MS SQLServer are not comparable to non-SQL databases when you have massive data processing and a large mass of concurrent connections.