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
_get_changed_fields fix for embedded documents with id field. #925
Conversation
|
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
6 similar comments
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 58b51dd on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
5 similar comments
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
Changes Unknown when pulling 378c3f1 on elephanter:fix__get_changed_fields into * on MongoEngine:master*. |
I also had this problem, but got used to it, always first setting .id to None after copying a document for example. But I think it is not such a great behaviour and your fix is welcome. It may be highlighted somewhere in the documentation, since it could surprise some users... |
|
@MRigal Care to issue a PR with the documentation change before I merge this? |
I think actually it should be a bit more than that. It's for example not clear which behaviour will happen when modifying the id. I think it should create a new document, but it could trick some user that may think it would update the document. I don't know it is so cool to make it silently, and in any case, I would add specific test that "documents" the behaviour and make sure it won't change. |
This proposal may actually take a completely new interest / scale when looking at it from the new difference in PyMongo 3.0 between update_one() and replace_one(). We may have a bit more to do here. I'm fine to make a PR for the doc, but I would at least like some comment on my previous comment |
@MRigal I don't understand. What do you mean with "should create a new document"? |
Sorry @elephanter , I should not review PR just based on Github's source code extract, but sometimes looking at the whole file... Then, it is perfect, good job, and IMHO mergeable ! 👍 |
@MRigal I activated Reviewable on this repository a while ago. |
Yes, I should have used it ! I will pay more attention. For me, it is good to merge! |
@DavidBord @yograterol @rozza Any objections? |
@thedrow I restarted the travis failed job, if built this PR will can merge. |
@yograterol We have some build problems. That job always fails. |
@thedrow yep, but I say about this job https://travis-ci.org/MongoEngine/mongoengine/jobs/56994446 |
done @thedrow 👍 |
@thedrow seems legit, but only after adding the change to |
@elephanter See @DavidBord's comment. |
@thedrow Ok, sorry ), it's my first pull request) |
|
No problem but now there are manual conflicts to resolve. |
removed commented out piece of code added author and record to changelog
d45b59e
to
f77f45b
Compare
@thedrow ok, guess I did it right ) |
Let's see what Travis says :) |
7 similar comments
_get_changed_fields fix for embedded documents with id field.
Thank you! |
When id field presented in Embedded document, changes inside this document was ignored in method _get_changed_fields because it's id was added to inspected array before processing it fields.
Also modify unittests for _delta method, which fails without code modification.