aheckmann / m

mongodb version management
MIT License
267 stars 55 forks source link

6.0+ m mongo #94

Closed DanielLaudisa95 closed 7 months ago

DanielLaudisa95 commented 7 months ago

Good afternoon community, There is a problem in the code of 'm' for all OSs with MongoDB version 6.0+. Indeed, mongo/mongoshell doesn't work because it is not pulled in from repositories. So I post my solution which is valid for all Linux/Unix/MacOS system:

npm install -g m
m --stable 6.0
m --latest 6.0
m 6.0.9
m bin 6.0.9
m tools ls
m tools stable
m tools 100.0.0
mkdir /root/.local/.data; mkdir /root/.local/.log; mkdir /root/.local/.conf; 
m use 6.0.9 --port 29000 --dbpath /root/.local/.data/ --logpath /root/.local/.log/mongod.log --fork

Download mongoshell from here: https://www.mongodb.com/try/download/shell
Install it with this procedure: https://www.mongodb.com/docs/mongodb-shell/install/

cp /usr/bin/mongosh /root/.local/m/versions/6.0.9/bin/
mv /root/.local/m/versions/6.0.9/bin/mongosh /root/.local/m/versions/6.0.9/bin/mongo
ln -sf /root/.local/m/versions/6.0.9/bin/mongo /root/.local/bin/mongo
m mongo 6.0.9 --port 29000 --host localhost

I hope this will help all you.

stennie commented 7 months ago

Hi @DanielLaudisa95,

This is expected behaviour since the mongo shell was removed from upstream MongoDB 6.0+ packages and replaced by the new MongoDB Shell (mongosh) which is a separate installation with more dependencies (including Node.js): https://www.mongodb.com/try/download/shell.

Since mongosh is compatible with a broad range of server versions (currently 4.2+), there shouldn't be a common need to have multiple versions installed.

In your workaround steps, instead of copying the mongosh binary it would be better to ensure /usr/bin (or the install location for mongosh) is in your $PATH variable.

m should also provide a hint about mongosh when installing 6.0+, but I will add mention of brew install mongosh for macOS users.

Cheers, Stennie