简体   繁体   中英

Can't run "mongo" command (mongo shell) on Ubuntu after installation

I am new to MongoDB. I already read the docs and MongoDB Community Edition. It is working

在此处输入图像描述

but, I tried to run the "mongo" command: It is not working!!

在此处输入图像描述

...So i did:

sudo apt install mongodb-clients

(I saw after that this command uninstalled the mongodb server, which i had to install again)

When it finished, i tried again the "mongo" command. It is not working?! How do I solve this?

You may want to try " mongosh " command.

As specified on documentation you provided.

Start a mongosh session on the same host machine as the mongod. You can run mongosh without any command-line options to connect to a mongod that is running on your localhost with default port 27017.

You need a client in order to interact with mongoDB deployment such as mongosh or Compass .

The MongoDB Shell, mongosh, is a fully functional JavaScript and Node.js 16.x REPL environment for interacting with MongoDB deployments. You can use the MongoDB Shell to test queries and operations directly with your database.

Hope It helps.

The mongodb-server and the mongodb-clients debian packages were for MongoDB 3.x, maintained by Ubuntu.

For MongoDB 4.x, MongoDB provide their own debian packages, but they named them mongodb-org-server , mongodb-mongosh and mongodb-cli . The client command mongo is split into two different commands mongocli and mongosh .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM