lmcq / firebase-firestorm

Firebase Firestorm is an ORM for Firestore which can be used with Typescript.
MIT License
252 stars 19 forks source link

`name` parameter in decorators is not getting to the in database, the property names are still used to persist data #12

Open davidassigbi opened 4 years ago

davidassigbi commented 4 years ago

I have this class but when i save it in firestore using firestorm.Collection(User).create(fakeUser()), the fields in the database are the keys of properties of User. I'd except user document keys are the name passed in option to the @field decorator

const fakeUser = (): User => ({ /** all fields are being populated here by faker library */})
@rootCollection({ name: 'users' })
export default class User extends Entity {
    @field({ name: 'nom' })
    name!: string;

    @field({ name: 'prenom' })
    firstName!: string;

    @field()
    email!: string;

    @field({ name: 'my_username' })
    userName!: string;
}