0

How to create mongdb database using laravel command? I manage to create mysql database using laravel command but it doesn't work for the coding.

public function handle()
{
    ...
    config(["database.connections.".$cur['db_conn'].".database" => null]);
    $query = "CREATE DATABASE $schemaName;";
    DB::statement($query);
3
  • github.com/jenssegers/laravel-mongodb Commented Jan 11, 2020 at 10:33
  • github.com/jenssegers/laravel-mongodb use for query collection. My challenges is to create mongo database. Commented Jan 11, 2020 at 13:40
  • Databases & collections in MongoDB are implicitly created when you first store data. Is it possible (but optional) to explicitly create collections with options like collation or schema validation, but there is currently no command to create a database. Commented Jan 11, 2020 at 14:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.