-
-
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
Bug: Mongoose ver. 5.11.X breaks population #9640
Comments
Can you show your schemas please? That will help us repro and fix this. |
As you can see 'desk' is not actually part of the schema. However it didn't error before |
… if square brackets contents aren't a number Re: Automattic/mongoose#9640
I haven't been able to repro this issue, but I put in a patch to mpath in mongoosejs/mpath@ffed519 that should fix this issue. Now mpath will treat |
Do you want to request a feature or report a bug?
a bug
What is the current behavior?
reproduction: basic model population:
query = mongoose.model('stories').find(conditionsInfo);
let populate = 'desk'
query.populate(populate);
{“error”:“Error: Can only use numbers in square bracket path notation, got character \“o\” in path \“desk[object\“\n at stringToParts (/usr/src/app/node_modules/mpath/lib/stringToParts.js:10:13)\n at Object.exports.get (/usr/src/app/node_modules/mpath/lib/index.js:51:7)\n at getModelsMapForPopulate (/usr/src/app/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js:242:32)\n at populate (/usr/src/app/node_modules/mongoose/lib/model.js:4323:21)\n at _populate (/usr/src/app/node_modules/mongoose/lib/model.js:4293:5)\n at db.base._promiseOrCallback.cb (/usr/src/app/node_modules/mongoose/lib/model.js:4269:5)\n at promiseOrCallback (/usr/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:9:12)\n at Mongoose._promiseOrCallback (/usr/src/app/node_modules/mongoose/lib/index.js:1135:10)\n at Function.Model.populate (/usr/src/app/node_modules/mongoose/lib/model.js:4267:23)\n at model.Query.Query._completeOne (/usr/src/app/node_modules/mongoose/lib/query.js:2078:9)\n at Immediate.Query.base.findOne.call (/usr/src/app/node_modules/mongoose/lib/query.js:2117:10)\n at Immediate._onImmediate (/usr/src/app/node_modules/mquery/lib/utils.js:116:16)\n at runCallback (timers.js:810:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)“}
looking at the mongoose.model object we observe this:
The text was updated successfully, but these errors were encountered: