【MongoDB】The description of index(一)
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.
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc3hiMDg0MTkwMTExNg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
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
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc3hiMDg0MTkwMTExNg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
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,
【MongoDB】The description of index(一)的更多相关文章
- mongodb 中的Multikey Index Bounds解释$elemMatch
首先说一下 $elemMatch的用法: { _id: 1, results: [ 82, 85, 88 ] } { _id: 2, results: [ 75, 88, 89 ] } $elemMa ...
- 【MonogDB】The description of index(二) Embedded and document Index
In this blog, we will talk about another the index which was called "The embedded ". First ...
- MongoDB - basic
mongoDB basic from:http://www.tutorialspoint.com/mongodb prject:https://github.com/chenxing12/l4mong ...
- MongoDB 知识要点一览
1.启动mongoDb数据库: 进入mongoDB的安装目录,执行如下命令 C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe --dbpath ...
- MongoDB.WebIDE:升级版的Mongodb管理工具
很早以前收藏了一片文章:<强大的MongoDB数据库管理工具>.最近刚好要做一些MongoDB方面的工作,于是翻出来温习了一下,用起来也确实挺方便.不过在使用过程中出现了一些个问题,加上更 ...
- Mongodb 和 普通数据库 各种属性 和语句 的对应
SQL to MongoDB Mapping Chart In addition to the charts that follow, you might want to consider the F ...
- MongoDB高级操作
参考MongoDB菜鸟教程 一.$type操作符 MongoDB 中可以使用的类型如下表所示: 类型 数字 备注 Double 1 String 2 Object 3 Array 4 ...
- MongoDB快速入门
http://www.yiibai.com/mongodb/mongodb_quick_guide.html 创建数据库 MongoDB use DATABASE_NAME 用于创建数据库.该命令如果 ...
- node.js+mongodb 爬虫
demo截图: 本demo爬瓜子二手车北京区的数据 (注:需要略懂 node.js / mongodb 不懂也没关系 因为我也不懂啊~~~) 之所以选择爬瓜子二手车网站有两点: 一.网站无需登录,少做 ...
随机推荐
- 基于visual Studio2013解决面试题之0902内存拷贝
题目
- VC Office2007界面对话框实现
我们知道VS2008SP1之后,MFC就多了一个功能包,可以快速的建立一个ribbon的界面,视觉样式可以在office 2007蓝.黑等颜色之间切换,这对于单文档/多文档做界面非常方便,而且也蛮好看 ...
- SonicUI在MFC中的使用
SonicUI是一个GUI引擎,提供了一些简单的UI组件实现高效率的UI效果,例如:自绘按钮.异形窗体.动画.超链接和图像操作方法.此项目作者开源到CodeProject,地址为:http://www ...
- 【虚拟化实战】容灾设计之一VR vs SRM
作者:范军 (Frank Fan) 新浪微博:@frankfan7 从本文开始,我们将介绍一系列的关于容灾的解决方案.先探讨应用的场景,然后再深入介绍技术架构. 情景一: 某小型公司的虚拟化环境中,在 ...
- jstl标签经典
1. <c:out> 库 :Core(核心库) URI : http://java.sun.com/jsp/jstl/core 前缀 : c 描述 :<c:out> 标签是一个 ...
- windows的定时任务设置
windows 的Schedule Task .创建配置 1.点击"開始" 2.点击"控制面板" 3.双击"任务计划" 4.双击" ...
- DRP分销系统总结
上个月看完的分销系统的视频,用了漫长的时间看这个项目视频,能安慰自己的是不光是看视频了,还做了很多自己想做的事情,比如驾照拿下来了,比如参加了一些考试,比如讲了一些课程等等.把这个系统的总结总算是补上 ...
- POJ 2632 Crashing Robots (坑爹的模拟题)
Crashing Robots Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6599 Accepted: 2854 D ...
- doT js模板入门
doT.js github地址: doT.js 官方站点 实例1:简单 <!DOCTYPE html> <html lang="en"> <head& ...
- 使用 Nginx 创建服务器的负载均衡
译序 Nginx 的负载均衡配置看上去很简单.以下是 Nginx 官方给的一个简单的负载均衡的例子: http { upstream myproject { server ...