Warning: the "mongo" shell has been superseded by "mongosh"
2022-04-24 22:39 abce 阅读(1695) 评论(0) 编辑 收藏 举报安装mongodb后,使用mongo登录,发现给出以下提示:
$ mongo MongoDB shell version v5.0.7 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("eddecffd-581c-4701-8017-73f5a1a0e162") } MongoDB server version: 5.0.7 ================ Warning: the "mongo" shell has been superseded by "mongosh", which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in an upcoming release. For installation instructions, see https://docs.mongodb.com/mongodb-shell/install/ ================
从MongoDB 4.0开始,可以使用MongoDB Shell连接MongoDB。
使用rpm方式安装mongosh
# vi /etc/yum.repos.d/mongodb-org-5.0.repo [mongodb-org-5.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc
然后安装
sudo yum install -y mongodb-mongosh
可以直接下载rpm软件包
https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-mongosh-1.3.1.el7.x86_64.rpm
连接示例:
mongosh mongosh "mongodb://localhost:28015" mongosh "mongodb://mongodb0.example.com:28015"
mongosh "mongodb://mongodb0.example.com.local:27017,mongodb1.example.com.local:27017,mongodb2.example.com.local:27017/?replicaSet=replA"
或者下载tgz格式的安装包进行安装
tar -zxvf mongosh-1.3.1-linux-x64.tgz