Skip to content
Logo Theodo

Choose a specific MongoDb version in Travis

Maxime Thoonsen1 min read

I just had a little problem with my tests on Travis due to a wrong MongoDb version. Travis uses the 2.4.12 version of MongoDb and I needed the 2.6.6 version. The official documentation of travis doesn’t provide a way to change the MongoDb version. Fortunately just before that I needed to specify the version of Elasticsearch and the documentation provided me an easy way to do so:

  - wget && sudo dpkg -i --force-confnew elasticsearch-1.2.4.deb

I just needed to install manually Elasticsearch. So why not doing the same thing for MongoDb with the help of the MongoDb documentation:

  - sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
  - echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
  - sudo apt-get update
  - sudo apt-get install -y mongodb-org=2.6.6 mongodb-org-server=2.6.6 mongodb-org-shell=2.6.6 mongodb-org-mongos=2.6.6 mongodb-org-tools=2.6.6
  - sleep 15 #mongo may not be responded directly. See
  - mongo --version

This quick hack permits our tests to run correctly.


Liked this article?