mercredi 1 mars 2017

Laravel 5.2 Mongo MonogDB Failed to parse MongoDB URI

I am getting this error:

MongoDB\Driver\Exception\InvalidArgumentException: Failed to parse MongoDB URI: 'http://mongodbmongo:tcp172.17.0.3:27017/mydatabase' in /var/www/laravel/vendor/mongodb/mongodb/src/Client.php:81

My enviroment variables look like this:

MONGO_DATABASE="mydatabase"
MONGO_HOST="mongo"
MONGO_PASSWORD=""
MONGO_PORT="27017"
MONGO_USERNAME=""

and my database.php looks like this

'mongodb' => [
    'driver'   => 'mongodb',
    'host'     => env('MONGO_HOST', 'localhost'),
    'port'     => env('MONGO_PORT', 27017),
    'database' => env('MONGO_DATABASE', 'mydatabase'),
    'username' => env('MONGO_USERNAME', ''),
    'password' => env('MONGO_PASSWORD', ''),
    'options' => [
        'database' => 'admin' // sets the authentication database required by mongo 3
    ]

I can correctly ping mongo from the container and it resolves to 172.17.0.3 as per the connection string. It seems as if the rest of the connection string is not getting generated correct?

I am running Laravel 5.2 and my package.json has this entry

"mongodb/mongodb": "^1.0.0",
"jenssegers/mongodb": "3.0.*",

As per http://ift.tt/1qxFWF0 3.0.X is highest compatibility for Laravel 5.2.

Many thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire