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.
2 parents 069b233 + 4ae4a7c commit f3f230aCopy full SHA for f3f230a
src/Jenssegers/Mongodb/Relations/EmbedsMany.php
@@ -227,7 +227,7 @@ public function attach(Model $model)
227
protected function associateNew($model)
228
{
229
// Create a new key if needed.
230
- if (!$model->getAttribute('_id')) {
+ if ($model->getKeyName() === '_id' && !$model->getAttribute('_id')) {
231
$model->setAttribute('_id', new ObjectID);
232
}
233
0 commit comments