TypeError: Cannot read property 'scope' of undefined -- After upgrading from mongoose 4.5.8 to 4.6.3
See original GitHub issueI’ve spent the past 24 hours trying to upgrade from mongoose 4.5.8 to 4.6.3, with no success. In certain scenarios I am getting the above error. Here is a full stack trace from my app, though I doubt it will provide a lot more information:
TypeError: Cannot read property 'scope' of undefined at model.Object.defineProperty.get [as restrictions] (<<root-path>>\node_modules\mongoose\lib\document.js:1729:38) at <<root-path>>\<<some-module>>.js:21:32 at bound (domain.js:287:14) at runBound (domain.js:300:12) at tryCatcher (<<root-path>>\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (<<root-path>>\node_modules\bluebird\js\release\promise.js:510:31) at Promise._settlePromise (<<root-path>>\node_modules\bluebird\js\release\promise.js:567:18) at Promise._settlePromise0 (<<root-path>>\node_modules\bluebird\js\release\promise.js:612:10) at Promise._settlePromises (<<root-path>>\node_modules\bluebird\js\release\promise.js:691:18) at Async._drainQueue (<<root-path>>\node_modules\bluebird\js\release\async.js:138:16) at Async._drainQueues (<<root-path>>\node_modules\bluebird\js\release\async.js:148:10) at Immediate.Async.drainQueues [as _onImmediate] (<<root-path>>\node_modules\bluebird\js\release\async.js:17:14) at processImmediate [as _immediateCallback] (timers.js:383:17)
At some point (that I can’t locate) in the execution path, the $__
field disappears and is replaced with a field whose name is [$]__
. From this point on access to any field on the model results in the above error.
Unfortunately I haven’t been able to reproduce this in an isolated environment with simple test scenarios, and I really don’t have much more information. But if someone could keep an eye out for this perhaps you can figure out what changed between these two mongoose versions that could cause this.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
I’m getting this error if I try and create a schema with a key of
remove
. I’m currently using 4.9.4.@davidgolden can you please open up a separate issue and follow the issue template please?