随笔分类 - mongo / mongo索引
摘要:列出数据库的所有索引 db.getCollectionNames().forEach(function(collection) { indexes = db[collection].getIndexes(); print("Indexes for " + collection + ":"); pri
阅读全文
摘要:要创建单字段索引,请使用以下原型: db.<collection>.createIndex( { <field>: <sortOrder> } ) 复合索引 要创建复合索引,请使用下列 db.collection.createIndex()方法: db.<collection>.createInde
阅读全文