-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
document#populate
behaves differently with query#populate
in mongoose 4.x
#7302
Comments
Thanks for reporting, will investigate ASAP |
Thanks @vkarpov15 |
Thanks for reaching out, the reason for "needs repro script" here is mostly pedantic. For us, a repro means we have either a standalone script or github repo that we can run and confirm that there is an issue. Generally we fill in the below template: const assert = require('assert');
const mongoose = require('mongoose');
mongoose.set('debug', true);
const GITHUB_ISSUE = `X`;
const connectionString = `mongodb://localhost:27017/${ GITHUB_ISSUE }`;
const { Schema } = mongoose;
run().then(() => console.log('done')).catch(error => console.error(error.stack));
async function run() {
await mongoose.connect(connectionString);
await mongoose.connection.dropDatabase();
} If you're willing to take the time to your code and sample data to the above template, that'll help us move faster on this issue. |
Confirmed, will release 4.13.18 tomorrow with the fix. |
Do you want to request a feature or report a bug?
Probably a bug.
What is the current behavior?
In the latest version of mongoose 4.x,
document#populate
behaves differently withquery#populate
If the current behavior is a bug, please provide the steps to reproduce.
When using the
query#populate
, the document's populated field can be modified normally:and the result is this
However, when using
document#populate
, the owner field will become unchangeable unless the new value is a mongoose document or nulland the result is this
This problem isn't appear when I was still using mongoose 4.7.8, it just appear when I try to push the mongoose version to latest 4.x. For mongoose 5.x, this problem don't appear too.
Please mention your node.js, mongoose and MongoDB version.
Node 8.12.0
Mongoose 4.13.17
MongoDB 3.2.21
The text was updated successfully, but these errors were encountered: