Home > Back-end >  Is there something like a symbolic link to a document in Firestore?
Is there something like a symbolic link to a document in Firestore?

Time:12-29

User0 has a has runbooks stored in

/Runbook/user0/runbooks/0...n

UserX has runbooks stored at /Runbook/userX/runbooks/0...n

UserX would like to include user0/runbooks/55 in his runbooks collection but doesn't want to move a copy into the runbooks collection. Is there a way to add a document into UserX's runbooks collection that will point to user0's 55 document?

CodePudding user response:

You can simply store enough information about the document in a field (for example, its ID or its full path). Or you can store a reference type field that also essentially just contains the full path of the document.

See also:

There is no type of document that itself is just a reference to another document. References are only valid as a document field type. You will have to model your data to account for this fact.

CodePudding user response:

Is there a way to add a document into UserX's runbooks collection that will point to user0's 55 document?

No. There is not. Duplicate data is common in document databases like Firestore, or Real Time Database. The correct thing to do is to duplicate the data.

  • Related