Multiple Mongo Versions
When I run mongo shell from ~ / Downloads / mongodb-osx-x86_64-2.4.5 / bin it runs version 2.4.5
./mongo
MongoDB shell version: 2.4.5
This is the version I just downloaded. However, when I run the mongo command from anywhere in my terminal, it launches a different version. I think this is because I (obviously) installed Mongo earlier.
MongoDB shell version: 2.2.0
connecting to: test
What do I need to do to make 2.4.5 respond to "mongo" from anywhere in the terminal (i.e. replace 2.2.0 with 2.4.5)
source to share
There is no reason why multiple concurrent releases of mongo cannot be installed. You can have multiple versions of mongo, and each one starts a different storage engine and also participates in a replica set.
Here are 3 installations on my mac for example.
drwxr-xr-x@ 18 rohitsood staff 612 Aug 21 18:53 mongodb-osx-x86_64-2.6.3 drwxr-xr-x@ 6 rohitsood staff 204 Jan 4 20:25 mongodb-osx-x86_64-3.0.8 drwxr-xr-x@ 8 rohitsood staff 272 Jan 7 12:31 mongodb-osx-x86_64-3.2.0
if you want to start an instance of mongod that maps to version 3.2 (latest) then make sure your path points to it.
Navigate to your Home (~) folder and open the .profile file to make these changes.
Here my view looks like a link
#Set up MongoDB
#export MONGODB_HOME=/Users/rohitsood/servers/mongodb-osx-x86_64-2.6.3
#export MONGODB_HOME=/Users/rohitsood/servers/mongodb-osx-x86_64-3.0.8
export MONGODB_HOME=/Users/rohitsood/servers/mongodb-osx-x86_64-3.2.0
export PATH=${MONGODB_HOME}/bin:${PATH}
Open up a new terminal and mongo should work as expected.
source to share