MongoDB db.runCommand({rolesInfo: 1}) 返回空数组的含义
在 MongoDB 中,执行 db.runCommand({rolesInfo: 1}) 命令可以获取当前数据库中定义的角色信息。如果返回结果的 'roles' 字段是一个空数组,即 { 'roles' : [], 'ok' : 1 },则表示当前数据库中没有定义任何角色。
例如,如果您的数据库名为 'test',并且您执行了以下命令:
use test;
db.runCommand({rolesInfo: 1});
如果返回的结果为 { 'roles' : [], 'ok' : 1 },则说明 'test' 数据库中没有定义任何角色。
原文地址: https://www.cveoy.top/t/topic/mQPJ 著作权归作者所有。请勿转载和采集!