-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Set option bypassDocumentValidation #2386
Unanswered
ruedigerm-playster
asked this question in
Q&A
-
Can anyone help me how to set the MongoDB option bypassDocumentValidation?
I wanna bypass schema validation when updating an item in MongoDB from my laravel application.
How can I pass the options array ['bypassDocumentValidation' => true] to my query?
I tried
'driver' => 'mongodb',
...
'username' => env('MONGO_DB_USERNAME'),
'password' => env('MONGO_DB_PASSWORD'),
'options' => ['bypassDocumentValidation' => true]
],
and also
Brand::find($brand->_id)->update([$data, ['bypassDocumentValidation' => true]);
or
$brand->save(['bypassDocumentValidation' => true]);
Every time, I still get the validation error ("Document failed validation").
Using
jenssegers/mongodb 3.9
Laravel 9.13
php 8.1
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment