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

216
Vistas
upserting mongoDB collection with CSV file

i have one mongoDB collection which have follwing value

        lat    long   band1
       23.454  56.454  67

i want to updated that collection so that i get follwing collection

      lat     long    band1  band2
      23.454  56.454  67      73

csv which i want to use for update is contains

  34.656,87.7565 ,78

size of this csv is 5gb

I'm using follwing commands to updated collection

 mongoimport --db test --collection nct_test --upsert --upsertFields band2 --file gdalexportedb8.csv

but I'm getting follwing error..

    Failed: error processing document #2: invalid character ',' looking for beginning of value

I want to know this is the right way or not and can anybody help me in this..

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

0

Regarding to your CSV file

  • Add a new line at the beginning containing field names.

Regarding to your command

  • Add these to your command: --type csv--headerline

for example:

$ cat > locations.csv
Name,Address,City,State,ZIP
Jane Doe,123 Main St,Whereverville,CA,90210
John Doe,555 Broadway Ave,New York,NY,10010
 ctrl-d
$ mongoimport -d mydb -c things --type csv --file locations.csv --headerline
connected to: 127.0.0.1
imported 3 objects
$ mongo
MongoDB shell version: 1.7.3
connecting to: test
> use mydb
switched to db mydb
> db.things.find()
{ "_id" : ObjectId("4d32a36ed63d057130c08fca"), "Name" : "Jane Doe", "Address" : "123 Main St", "City" : "Whereverville", "State" : "CA", "ZIP" : 90210 }
{ "_id" : ObjectId("4d32a36ed63d057130c08fcb"), "Name" : "John Doe", "Address" : "555 Broadway Ave", "City" : "New York", "State" : "NY", "ZIP" : 10010 }
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