-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property '$__' of undefined at _updateParentPopulated #8317
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
I'm running into the same issue after upgrading from 5.7.7 to 5.7.8! |
had the same issue going to 5.6.x - 5.7.10, workaround i found was not mutating the original array from the document same issue as #8312 |
Same issue going from 5.5.x to 5.7.11. Downgrading back to 5.7.7 fixed the issue |
vkarpov15
added
the
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
label
Nov 16, 2019
vkarpov15
added a commit
that referenced
this issue
Nov 17, 2019
vkarpov15
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
labels
Nov 17, 2019
This is a bug with Repro script: 'use strict';
const mongoose = require('./');
const {Schema} = mongoose;
const assert = require('assert');
const personSchema = new Schema({
friends: [{ name: { type: String } }]
});
const Person = mongoose.model('Person', personSchema);
const person = new Person({ friends: [{ name: 'Hafez' }] });
const friendsNames = person.friends.map(friend => friend.name);
let threw = false;
try {
friendsNames.push('Sam');
} catch (err) {
threw = true;
console.log(err);
}
assert.equal(threw, false);
assert.equal(friendsNames.length, 2);
assert.equal(friendsNames[1], 'Sam'); |
AbdelrahmanHafez
added a commit
to AbdelrahmanHafez/mongoose
that referenced
this issue
Nov 17, 2019
AbdelrahmanHafez
added a commit
to AbdelrahmanHafez/mongoose
that referenced
this issue
Nov 17, 2019
This was referenced Mar 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, this seems similar to #3889.
I am using node 8.10.0, mongodb 3.2.11 and mongoose 5.7.9
I have the following code:
The last line throws the error:
TypeError: Cannot read property '$__' of undefined
at _updateParentPopulated (/home/shaolin/Documents/software/normative-gui/node_modules/mongoose/lib/types/documentarray.js:323:14)
at CoreDocumentArray.splice (/home/shaolin/Documents/software/normative-gui/node_modules/mongoose/lib/types/documentarray.js:228:5)
at model.theorySchema.methods.isIndependent (/home/shaolin/Documents/software/normative-gui/models/theory.js:145:11)
at /home/shaolin/Documents/software/normative-gui/controllers/theoryController.js:202:14
at /home/shaolin/Documents/software/normative-gui/node_modules/mongoose/lib/model.js:4604:16
at /home/shaolin/Documents/software/normative-gui/node_modules/mongoose/lib/query.js:4351:12
at process.nextTick (/home/shaolin/Documents/software/normative-gui/node_modules/mongoose/lib/query.js:2849:28)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
The model is
Downgrading to 4.4.3 also fixes it in my case.
Thank you.
The text was updated successfully, but these errors were encountered: