We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc78c75 commit d795dacCopy full SHA for d795dac
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
@@ -236,7 +236,7 @@ public function attach(Model $model)
236
protected function associateNew($model)
237
{
238
// Create a new key if needed.
239
- if (!$model->getAttribute('_id')) {
+ if ($model->getKeyName() == '_id' && !$model->getAttribute('_id')) {
240
$model->setAttribute('_id', new ObjectID);
241
}
242
0 commit comments