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

334
Vistas
Changing Mongoose schema type not working

I have a mongoose schema with a property which was a string array.

docs: [String]

I changed the type to an object array as follows

docs: [{ url: String, type: String }]

But when I create a new item, the docs field is still validated with the type string and the following error is thrown.

enter image description here

I even tried dropping the collection and it still not works.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The brackets should be around the type, and not the entire object. As documented here, instead of your Schema being:

docs: [{ url: String, type: String }]

It should be

docs: { url: String, type: [String] }
about 4 years ago · Juan Pablo Isaza 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