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

877
Vistas
Sequelize Error on DataTypes.ARRAY(DataTypes.STRING)

I am new to NodeJs development I am using NodeJs with mysql and Sequelize to create a Batch model with these properties.

const Batch = sequelize.define(
  "Batch",
  {
    title: { type: DataTypes.STRING, allowNull: false },
    studentIds: { type: DataTypes.STRING },
    teacherId: { type: DataTypes.STRING, allowNull: true }
  },
  {
    timestamps: false
  }
);

On async method call it is working fine.

Batch.sync().then((res) => {
  console.log("Batch model sync : ", Batch === sequelize.models.Batch);
});

But I need to change

studentIds: { type: DataTypes.ARRAY(DataTypes.STRING)}

Whenever I make this change it gives error

enter image description here

I am using node 14.5.0 MySql 8.0.21 and Sequelize 6.3.4

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

DataTypes.ARRAY is not available on Mysql, it's only available on postgres.

Check in official docs: https://sequelize.org/master/class/lib/data-types.js~ARRAY.html

over 4 years ago · Santiago Trujillo Denunciar
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