title: Laravel switch mysql to mongodb
body: <p>After completed my project I deiced switch mysql to mongodb. I am using Laravel 5.4 version and for mongodb use <a href="https://github.com/jenssegers/laravel-mongodb" rel="nofollow noreferrer">jenssegers</a>. For laravel mongdb installation I follow jenssegers installation documentations and installation successfully completed. But after installation I go for migration and use command <code>php artisan migrate</code>. When I use this command shown error <code>InvalidArgumentException in /vendor/mongodb/mongodb/src/Database.php line 83: $databaseName is invalid:</code></p>
  
  <p>My database.php</p>
  
  <pre><code>'default' =&gt; env('DB_CONNECTION', 'mongodb'),
  
  'connections' =&gt; [
  
      'sqlite' =&gt; [
          'driver' =&gt; 'sqlite',
          'database' =&gt; env('DB_DATABASE', database_path('database.sqlite')),
          'prefix' =&gt; '',
      ],
  
      'mysql' =&gt; [
          'driver' =&gt; 'mysql',
          'host' =&gt; env('DB_HOST', 'localhost'),
          'port' =&gt; env('DB_PORT', '3306'),
          'database' =&gt; env('DB_DATABASE', 'forge'),
          'username' =&gt; env('DB_USERNAME', 'forge'),
          'password' =&gt; env('DB_PASSWORD', ''),
          'charset' =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix' =&gt; '',
          'strict' =&gt; true,
          'engine' =&gt; null,
      ],
  
      'pgsql' =&gt; [
          'driver' =&gt; 'pgsql',
          'host' =&gt; env('DB_HOST', 'localhost'),
          'port' =&gt; env('DB_PORT', '5432'),
          'database' =&gt; env('DB_DATABASE', 'forge'),
          'username' =&gt; env('DB_USERNAME', 'forge'),
          'password' =&gt; env('DB_PASSWORD', ''),
          'charset' =&gt; 'utf8',
          'prefix' =&gt; '',
          'schema' =&gt; 'public',
          'sslmode' =&gt; 'prefer',
      ],
      'mongodb' =&gt; [
          'driver'   =&gt; 'mongodb',
          'host'     =&gt; env('DB_HOST', 'localhost'),
          'port'     =&gt; env('DB_PORT', 27017),
          'database' =&gt; env('DB_DATABASE', 'project_db'),
          'username' =&gt; env('DB_USERNAME'),
          'password' =&gt; env('DB_PASSWORD'),
          'options'  =&gt; [
              'database' =&gt; 'admin' // sets the authentication database required by mongo 3
          ]
      ],
  
  ],
  </code></pre>
  
  <p>My .env </p>
  
  <pre><code>DB_CONNECTION=mongodb
  DB_HOST=localhost
  DB_PORT=27017
  DB_DATABASE=admin
  DB_USERNAME=
  DB_PASSWORD=
  </code></pre>
  
  <p>And I also facing one more problem if whatever I change in <code>.env</code> and <code>database.php</code> like if I change port <code>27017</code> to <code>3303</code> but on browser shows <code>27017</code>. I cleared cache and all. I don't know what is problem in my code.</p>