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
Add support for Embedded column name #5361
Comments
Hmm I would say this should be already working. |
Maybe I'm not looking at the right place but this is the definition for export type EmbeddedOptions = {
entity?: string | (() => AnyEntity | AnyEntity[]);
type?: string;
prefix?: string | boolean;
nullable?: boolean;
object?: boolean;
array?: boolean;
hidden?: boolean;
serializer?: (value: any) => any;
serializedName?: string;
}; in It doesn't seem to have a |
Ok, but that might be just a type-level issue, have you tried to put it in (and cast the options |
I just gave it a try. On insert, it skips the field, meaning the document created in mongoDB doesn't have the data, neither with the class attribute name nor the decorator config name. On select, it throws an error |
@maphe I got the same error as well but with |
Is your feature request related to a problem? Please describe.
Currently it is possible to define the name of a column to be different from the name of the ts/js field
It is also possible to define an embedded object
but it doesn't seem to be possible to combine both
Describe the solution you'd like
Would be nice to be able to do something like
Describe alternatives you've considered
The only alternative is to have the attribute name match the db name.
Additional context
This might be more of a mongoDB use case where nested objects are fairly common and it's not unusual to shorten the db field name for storage optimization, but still want the application name to be verbose to keep the code understandable.
But Im sure it can also have some SQL use cases...
The text was updated successfully, but these errors were encountered: