为什么我的远程登录MongoDB成功,但我不能使用命令' show collections'?

时间:2017-08-17 12:02:20

标签: javascript node.js mongodb shell

当我远程登录mongodb时,我会看到它的成功,但当我使用命令"使用databasename" "展示馆藏"

你会看到这个。 它在远程客户端上是错误的

               <?php
                add_action('wp_head', 'add_to_wp_head');
                function add_to_wp_head( )
                {
                    if (is_single())
                    {
                        global $post;
                        $m_meta_description = get_post_meta($post->ID, 'm_meta_description', true);
                        echo '<meta name="description" content="' . $m_meta_description . '"/>';
                    }
                }
                ?>

但它通常位于主机192.168.1.202,就像这样

root@c148ad06550e:/# mongo --host 192.168.1.202 -uroot -proot --authenticationDatabase admin
> MongoDB shell version: 3.2.13
> connecting to: 192.168.1.202:27017/test
> Server has startup warnings: 
> 2017-06-01T16:53:00.807+0800 I CONTROL  [initandlisten] ** WARNING:
> You are running this process as the root user, which is not recommended.
2017-06-01T16:53:00.807+0800 I CONTROL  [initandlisten]
> use admin
switched to db admin
> show collections
2017-08-17T19:45:01.817+0800 E QUERY    [thread1] TypeError: cmdResult.cursor is undefined :
DBCommandCursor@src/mongo/shell/query.js:692:5
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:776:16
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:785:19
DB.prototype.getCollectionNames@src/mongo/shell/db.js:796:16
shellHelper.show@src/mongo/shell/utils.js:754:9
shellHelper@src/mongo/shell/utils.js:651:15
@(shellhelp2):1:1
> db.users.find()
> show users
{
"_id" : "admin.root",
"user" : "root",
"db" : "admin",
"roles" : [
    {
        "role" : "root",
        "db" : "admin"
    }
] }

我看到mongodb版本在客户端和服务器上不一样, 3.2和2.8。

任何人都可以告诉我为什么?

0 个答案:

没有答案