Home > Database > Mysql Tutorial > MongoDB 之旅(三) 基本管理(MongoDB Javascript Shell)

MongoDB 之旅(三) 基本管理(MongoDB Javascript Shell)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:54:50
Original
957 people have browsed it

MongoDB 之旅(三) 基本管理(MongoDB Javascript Shell)Posted on 以下方式可以获取数据库信息: show dbs; show collections; db.stats(); db.members.stats(); db.runCommand({dbstats:1}); db.runCommand({collstats:1}); db.runCommand = db.$cmd.fin

MongoDB 之旅(三) 基本管理(MongoDB Javascript Shell) Posted on

以下方式可以获取数据库信息:

show dbs;  show collections;

db.stats();  db.members.stats();  db.runCommand({dbstats:1});  db.runCommand({collstats:1});

db.runCommand = db.$cmd.findOne

db.help();

此外,shell还有内置的Tab不全机制;

db.numbers.save;//查看save方法的内部实现。

其它:

对象ID的生成:

每个集合中对于所有的文档必须是唯一的,主键是存放在文档中的_id字段中。由12个字节的特定结构组成的。id=4个字节的时间戳(Unix时间戳)+3字节的机器ID+2字节的进程ID+3字节的计数器。如:4c291865 238d3b 19b2 000001. 大部分驱动是允许提供这个时间戳,提供创建时间,香港服务器,香港空间,精确到最接近的一秒钟。

BSON:

既是MongoDB的存储格式又是命令格式。所有的文档都以BSON格式存储在磁盘上,所有查询和命令都由BSON文档来指定。故,美国服务器,所有的MongoDB的驱动必须在语言特定的文档描述和BSON之间进行转换。

BSON规范中包含19种类型。

数据库驱动的核心功能如下:创建ID,序列化BSON以及和数据库服务器通信。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
mongodb start
From 1970-01-01 08:00:00
0
0
0
linux - ubuntu14 error installing mongodb
From 1970-01-01 08:00:00
0
0
0
Use of symfony2 mongodb
From 1970-01-01 08:00:00
0
0
0
mongodb _id rename
From 1970-01-01 08:00:00
0
0
0
Parameter understanding of mongodb
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template