0

I try to update my Eloquent model while bypassing the validation (because some items break their schema).

As I understand the mongodb package, it should be possible to pass an option ['bypassDocumentValidation' => true]

I tried to set this option both in the DB config

            'driver'   => 'mongodb',
             ...
            'username' => env('MONGO_DB_USERNAME'),
            'password' => env('MONGO_DB_PASSWORD'),
            'options'  => ['bypassDocumentValidation' => true]
        ],

as well as using the update

Brand::find($brand->_id)->update([$data, ['bypassDocumentValidation' => true]);
or 
$brand->save(['bypassDocumentValidation' => true]);

Every time, I still get the validation error ("Document failed validation").

How can I pass the option to MongoDB?

PepeNietnagel
  • 230
  • 2
  • 10

0 Answers0