MongoDB后台管理Shell

MongoDB Shell是MongoDB自带的交互式Javascript shell,用来对MongoDB进行操作和管理的交互式环境。

进入MongoDB后台后,默认会链接到 test文档(数据库):

# mongo
MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.4
Welcome to the MongoDB shell.

由于它是一个JavaScript shell,可以运行一些简单的算术运算:

> 4+4
8
> 

现在我们插入一些简单的数据,并对插入的数据进行检索:

> db.appblog.insert({x:10})
WriteResult({ "nInserted" : 1 })
> db.appblog.find()
{ "_id" : ObjectId("5aead830134346012ef0f4bc"), "x" : 10 }
> 

第一个命令将数字 10 插入到 appblog 集合的 x 字段中。

上一篇 数据库优化方案总结
下一篇 MongoDB数据库基本操作
目录
文章列表
1 AlertDialog、Dialog、AppCompatDialogFragment自定义弹框点击空白处自动关闭
AlertDialog、Dialog、AppCompatDialogFragment自定义弹框点击空白处自动关闭
2
CentOS下部署Magento2
CentOS下部署Magento2
3
nginx-rtmp流媒体服务器搭建
nginx-rtmp流媒体服务器搭建
4
Retrofit2学习之七:上传多个文件
Retrofit2学习之七:上传多个文件
5
微服务网关 Spring Cloud Gateway 进阶
微服务网关 Spring Cloud Gateway 进阶
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。