<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
use Jenssegers\Mongodb\Schema\Blueprint;
class CreateDriversTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('mongodb')->create('drivers', function (Blueprint $collection) {
$collection->string('first_name');
$collection->string('last_name');
$collection->string('id_number');
$collection->string('username');
$collection->string('email')->nullable();
$collection->string('password');
$collection->string('api_token');
$collection->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('mongodb')->drop('drivers');
}
}
When I run migrate:fresh with my migration organised as the above, the error log says
a collection 'example.drivers' already exists
When I move Schema::connection('mongodb')->drop('drivers') into the up() function of the migration file, the collection is dropped and all works correctly. The down function is being reached, but it is almost as if the statement inside it is being ignored.
Mongodb does not support schema's like you are defining them.
Check the documentation for supported operations:

your drop statement should work though
Thanks for the response.
Unfortunately even following the documentation, the collection does not drop
dropIfExists has never failed me so far. Also do not specify cast Blueprints, omit it.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;
class CreateEventAuditCollection extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('audit')->create('event_audits', function ($collection) {
$collection->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('audit')->dropIfExists('event_audits');
}
}
`
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateServicesMongoTable extends Migration
{
protected $connection = 'mongodb'; /**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection($this->connection)->create('collections', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->boolean('withUsers')->default('false');
$table->string('type');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection($this->connection)->drop('services');
}
}
`
see this https://github.com/jenssegers/laravel-mongodb/issues/1241#issuecomment-433906115