Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!