Yii2无法在mongodb中提取消息

时间:2018-09-19 09:10:25

标签: yii2

Yii2无法在mongodb中提取消息

我想使用mongodb作为消息源来存储消息和翻译

这是我的配置

return [

    'sourcePath' => __DIR__ . DIRECTORY_SEPARATOR . '..',
    'languages' => ['zh-CN', 'de'],
    'translator' => 'Yii::t',
    'sort' => false,
    'removeUnused' => false,
    'markUnused' => true,
    'only' => ['*.php'],
    'except' => [
        '.svn',
        '.git',
        '.gitignore',
        '.gitkeep',
        '.hgignore',
        '.hgkeep',
        '/messages',
    ],
    'catalog' => 'app',
    'overwrite' => true,

    /*
    // Message categories to ignore
    'ignoreCategories' => [
        'yii',
    ],
     */


    // 'db' output format is for saving messages to database.
    'format' => 'db',
    // Connection component to use. Optional.
    'db' => 'mongodb',
    // Custom source message table. Optional.
    // 'sourceMessageTable' => '{{%source_message}}',
    // Custom name for translation message table. Optional.
    // 'messageTable' => '{{%message}}',


];

main.php

 'mongodb' => [
        'class' => '\yii\mongodb\Connection',
        'dsn' => 'mongodb://127.0.0.1:27017/mongotestdb',
    ]

遇到此错误

带有消息““ mongodb”的

异常'yii \ base \ InvalidConfigException'是指yii \ mongodb \ Connection组件。 yii \ db \需要连接。'

0 个答案:

没有答案