博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mongodb 索引
阅读量:4199 次
发布时间:2019-05-26

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

mongodb的索引的创建方法;

db.collection.ensureIndex(keys,options) 在mongodb3.0版本后被弃用。

现在是db.collection.createIndex()的别名

db.colleciton.getIndexes()得到collection的所有的索引 () 只能在3.0版本用

For MongoDB 3.0 deployments using the  storage engine, if you rundb.collection.getIndexes() from a version of the  shell before 3.0 or a version of the driver prior to db.collection.getIndexes() will return no data, even if there are existing indexes. For more information, see .

得到collection的所有索引:

db.people.getIndexes()

To return a list of all indexes on all collections in a database, usethe following operation in the shell:

db.system.indexes.find()

转载地址:http://aodli.baihongyu.com/

你可能感兴趣的文章
【一天一道LeetCode】#30. Substring with Concatenation of All Words
查看>>
【一天一道LeetCode】#60. Permutation Sequence.
查看>>
【一天一道LeetCode】#62. Unique Paths
查看>>
【一天一道LeetCode】#61. Rotate List
查看>>
【一天一道LeetCode】#63. Unique Paths II
查看>>
【一天一道LeetCode】#36. Valid Sudoku
查看>>
【一天一道LeetCode】#75. Sort Colors
查看>>
【一天一道LeetCode】#76. Minimum Window Substring
查看>>
【计算机网络 第五版】阅读笔记之一:概述
查看>>
【计算机网络 第五版】阅读笔记之二:物理层
查看>>
【计算机网络 第五版】阅读笔记之三:数据链路层
查看>>
【计算机网络 第五版】阅读笔记之四:网络层
查看>>
【计算机网络 第五版】阅读笔记之五:运输层
查看>>
【一天一道LeetCode】#77. Combinations
查看>>
【一天一道LeetCode】#78. Subsets
查看>>
【一天一道LeetCode】#79. Word Search
查看>>
【一天一道LeetCode】#81. Search in Rotated Sorted Array II
查看>>
【数据结构与算法】深入浅出递归和迭代的通用转换思想
查看>>
【一天一道LeetCode】#83. Remove Duplicates from Sorted List
查看>>
【一天一道LeetCode】#91. Decode Ways
查看>>