博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【MongoDB】The description of index(一)
阅读量:6943 次
发布时间:2019-06-27

本文共 1109 字,大约阅读时间需要 3 分钟。

From this blog, we start to talk about the index in mongo Database, which is similar to the traditional database. Generally speaking, if the index need to be created in the traditional database, so does MongoDB.  In MongoDB ,the field '_id ' has been set index by default and this index is so special that it cannot be deleted except for Capped Collections.

Before studying the index, now we create 10000 test records as follows.

1 Create index

In mongodb, using the function ensureIndex() to create tne index, for example: 

      db.test.ensureIndex({name : 1}) means to create index for name

2. Use index 

generally speaking, there is five way to create index based on  the practice condition. 

2.1 Common Index

query the result before creating index and after. 

             Some explanation of result field:

Cursor: value [BasicCursor or BtreeCursor], the later explain this query has used index.

nscanned: the number of index of having scan. 

n : return the number of document, namely return the line 

millis: the total time of finishing this query, unit millinus seconds.

indexBounds: if not null, it will describe the index item,

        

你可能感兴趣的文章
纳德拉:云计算是重要增长点18年目标200亿
查看>>
聚焦“微服务与容器云” 2017CIO时代线下CIO沙龙顺利举行
查看>>
入行数据科学,仅需6步
查看>>
Linux虚拟化技术KVM、QEMU与libvirt的关系(转)
查看>>
特斯联科技携手比特大陆共建国内首家物联网区块链实验室
查看>>
微服务架构
查看>>
数字化转型 Make it REAL
查看>>
Spring实现封装自定义注解@Trimmed清除字符串前后的空格
查看>>
CentOS 7安装过程
查看>>
Fiori里花瓣的动画效果实现原理
查看>>
HDU 小兔的棋盘
查看>>
首个人工智能专业委员会成立,产业发展再添动力
查看>>
jQuery UI 拖动(Draggable) - Handles和Cancel
查看>>
Oracle 存储过程发送邮件
查看>>
程序员必须知道的数据库增删改查
查看>>
Git常用命令
查看>>
oracle12c之 单机12.1.0.1打补丁
查看>>
[转]nodejs npm常用命令
查看>>
ibatis-调用存储过程
查看>>
Linux网络协议栈(三)——网络设备(1)
查看>>