Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Set option bypassDocumentValidation #2386

Unanswered
ruedigerm-playster asked this question in Q&A
Discussion options

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

see also
https://stackoverflow.com/questions/72281028/set-option-bypassdocumentvalidation-for-laravel-mongodb-jenssegers-mongodb

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /