yamankatby / firebase-extensions

A collection of Firebase Extensions designed to help you build better apps faster.
Apache License 2.0
33 stars 1 forks source link

Planning `firestore-one-to-many` extension 🧠 #54

Open yamankatby opened 1 year ago

yamankatby commented 1 year ago

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?

Meistercoach83 commented 1 year ago

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?