Open yamankatby opened 1 year ago
Implements the one-to-many relationship between Firestore collections.
The path to the collation containing the documents represents the first side of the relation, the "one" side. Example: authors
authors
The path to the collation containing the documents represents the second side of the relation, the "many" side. Example: books
books
The name of the field in the destination collection that contains the reference of the document in the target collection. Example: authorId
authorId
The name of the field in the target collection where the id of the destination document will be stored. Example: bookId Default: id
bookId
id
The name of the field in the target document where the list of the destination documents will be stored. Example: books
The name of the field in the destination document where the data from the target document will be stored. Example: author
author
A comma-separated list of field names to copy from the target collection to the destination collection. Example: name,biography
name,biography
A comma-separated list of field names to copy from the destination collection to the target collection. Example: title,summary
title,summary
What should happen to the documents in the destination collection when a related target collection is deleted?
Hey! I think I was able to add this features to my project - would you like to check my code and take a look if you could use it?
Implements the one-to-many relationship between Firestore collections.
Params 🛠️
Target Collection Path
The path to the collation containing the documents represents the first side of the relation, the "one" side. Example:
authors
Destination Collection Path
The path to the collation containing the documents represents the second side of the relation, the "many" side. Example:
books
Target Ref Field Name
The name of the field in the destination collection that contains the reference of the document in the target collection. Example:
authorId
Destination Ref Field Name
The name of the field in the target collection where the id of the destination document will be stored. Example:
bookId
Default:id
Target Data Field Name
The name of the field in the target document where the list of the destination documents will be stored. Example:
books
Destination Data Field Name
The name of the field in the destination document where the data from the target document will be stored. Example:
author
Fields to copy from the target collection
A comma-separated list of field names to copy from the target collection to the destination collection. Example:
name,biography
Fields to copy from the destination collection
A comma-separated list of field names to copy from the destination collection to the target collection. Example:
title,summary
Target document deletion behaviour
What should happen to the documents in the destination collection when a related target collection is deleted?