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

206
Vistas
How to call "mongoimport" from a Node.js child-process on Travis-CI.org?

First question on SO... sorry if this goes wrong.

I'm using Mocha to test a Node.js module. The module uses child_process.exec() to call the mongoimport command... if all goes well it should load some test-data into a MongoDB database.

All tests pass on my laptop (Node 6.9, MongoDB v3.4.1), but things fail when I move to using Travis-CI.org:

{
"killed": false,
"code": 127,
"signal": null,
"cmd": "mongoimport -h localhost:27017 -d test -c test_planets --type json --file \"/tmp/planet.json\" --upsertFields planetName"
}

...because, I guess, it's not finding the mongoimport command?

SO helped point me to this .travis.yml file that seems to work great to get a V3 MongoDB spun-up:

language: node_js
node_js:
  - "6.9"
sudo: false
addons:
  apt:
    sources:
      - mongodb-upstart
      - mongodb-3.0-precise
    packages:
      - mongodb-org-server
      - mongodb-org-shell

before_script:
  - sleep 15

...and I'm happy MongoDB is available (other tests have connected and passed). I need a recent version for all the new upsert stuff.

  • But I've hit a wall about how to run the mongoimport command from a Node.js child process on Travis-CI (new to that as well). Is it even possible?

Any help very much appreciated!

Tim

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

0

Just add "mongodb-org-tools" to the packages section of your .travis.yml file. That will make the mongoimport command available.

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