My question is that what is the equivalent of a collection and a document of firebase in other databases like SQL or MongoDB,
I know that there is a table in SQL but what is the equivalent of the following path:
/collection/document/collection
I mean that can I add a table(collection) to a document in SQL or mongoose and what is the architecture of that?
Thanks,
A Firestore collection is roughly equivalent to a SQL table.
A Firestore document is roughly equivalent to a SQL row.
Nested subcollections in Firestore don't have a direct SQL equivalent. You would just use another table for that. Since tables can't be "nested" in SQL, it has to exist at the top level along with all the others.
The closest equivalents to collections and documents in a relation database would be a table and a row. But as you've found, Firestore allows nesting collections under documents again, and there's no way to nest tables under rows in relational databases.
What you'd do in a relational database is add a parent key to the rows that are under another record. So if you have a collection
and a subcollection
in Firestore, you could for example model that as two separate tables in a relational database, where you then give each row/record in subcollection
a foreign key with the ID of the collection
record that it falls under.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With