Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

72
Visualizações
Converting table head in CSV file to schema field

I am demanded to define a schema for a CSV file using Mongoose, but after I peeked through the CSV file, I found there are almost a hundred fields or columns in the CSV file. I know how to define a schema in Mongoose using only a few fields, but I am totally unsure how to define such schema. Is there an efficient way of doing that, such as reading through the head of the CSV and copy those heads into an javascript object and then pass the object to the mongoose.Schema()

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Using this package https://www.npmjs.com/package/csvjson you can convert csv file to JSON.

Then secondly, you can convert the generated JSON to mongoose schema using this package, https://github.com/topliceanu/mongoose-gen.

You may need to edit the field types. I hope it works for you.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda