Home > Back-end >  Firestore "Reference" versus "DocumentReference"
Firestore "Reference" versus "DocumentReference"

Time:09-15

So there's a Firestore Reference object created with db.ref("parent/child").

And there's a Firestore DocumentReference object created with doc(db, "parent", "child")

The documentation makes it seems like these are slightly different. But how are they different? Why would I use one versus the other?

CodePudding user response:

Each of the shared references points to a particular location in a database. However, even if both, the Firebase Realtime Database and Cloud Firestore, are Firebase products, both are two totally different products, with totally different concepts.

The first reference points to a node that exists in the Realtime Database, while the second one, points to a document that exists in a Firestore collection.

  • Related