Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Feature: Firestore subcollections #52

Open
brettwillis opened this issue Mar 9, 2021 · 0 comments
Open

Feature: Firestore subcollections #52

brettwillis opened this issue Mar 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@brettwillis
Copy link
Member

Allow a model to be configured as a subcollection of a parent model, by adding a parentModel option.

{
  "options": {
    "parentModel": "users"
  },
  "attributes": {
    "owner": {
      "model": "users"
    }
  }
}

If there is a one-way relation to the parent model, then that reltion will become the partent document of the subcollection. If there is no one-way relation to the parent model, then one will be implicitly created with the name "parent".

If the parent relation is changed, then the document will be deleted from the old subcollection and added to the new subcollection.

@brettwillis brettwillis added the enhancement New feature or request label Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant