mongodb查看索引使用情况

db.getCollection("collectionName").aggregate([{$indexStats:{}}])

db.runCommand({createRole:"index_stats_role",privileges:[{resource:{"db":"dbName","collection":""},actions:["indexStats"]},],"roles":[]})
db.grantRolesToUser("userName",[{"role":"index_stats_role","db":"dbName"}])

posted on 2022-07-14 10:17  河蟹黄  阅读(514)  评论(0编辑  收藏  举报

导航