-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom repository collection/table name #2844
Comments
IIUC, you have one model used with two repository classes and you would like to control the collection/table name in the repository, overwriting any default value provided by the model. Is that correct? |
That is correct. The repository should therefore hold the collection name instead of the model to avoid any ambiguity IMHO. |
I would like to propose a different solution:
@raymondfeng thoughts? @JesusTheHun would you like to contribute this improvement yourself? See Contributing code and Submitting a pull request to LoopBack 4 to get started. |
Pre-post : I'm a bit tilted today, sorry if I'm a bit rude :/ IMHO having the model to carry the collection name is bad. I know it's widespread but I think it is bad in several ways :
Since we reached GA, I can't ask your a breaking change. I'm willing to produce a PR for this. Do you have a gitter for contributers ? |
I think I see your point. To me, this seems like a classic trade-off between making things easier to use (compute the table name from the model name) and more robust (require the repository to provide the table name). In my proposal, the first item is about preserving backwards compatibility for existing users - this is what we already have implemented today. The second point is about enabling your use case, I am envisioning it as an incremental addition (a backwards-compatible feature).
Lovely! Let me know how can I help you. We are not very active on Gitter, but I'll try to be there more often in the next days. Let's meet here: https://gitter.im/strongloop/loopback-next |
Hello ! Can I be assigned to this one ? |
Currently the name of the collection is specified in the model, through the setting property of the model decorator.
I have two repositories, one storing the current version of the data, the other storing all versions of the data. Right now when I use the create method from those repo, they try to save into the same collection, creating errors.
I would like to store the model in different collections.
Also see this issue, probably code related.
The text was updated successfully, but these errors were encountered: