Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
TypeOrm & MongoDB: Column aliases ignored on insert/save

When using column aliases with MongoDB, TypeORM does not use the alias (Column name) when inserting/updating records, it only uses it when querying data.

Expected Behavior

When declaring a class like this

@Entity({ name: 'users' })
export class User {
   @ObjectIdColumn() readonly id: ObjectID;
   @Column({ name: "first_name" }) firstName: string;
}

and inserting a new record with a MongoRepository like this

const newUser = this.usersRepository.create({ firstName: 'Joe' });
return await this.usersRepository.save(newUser);

I expect the fields in then record in the database to be snake case not camel case

Actual Behavior

firstName column is not mapped to first_name

Steps to Reproduce

Create an entity like the following and use the type orm MongoRepository to save a new record.

@Entity({ name: 'users' })
export class User {
   @ObjectIdColumn() readonly id: ObjectID;
   @Column({ name: "first_name" }) firstName: string;
}

Environment

Dependency Version
OS Windows 10
NodeJs 16.6.2
TypeORM 0.2.37
MongoDB 4.2

Crossposted from Github Issues

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda