{"action":"created","issue":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/978","labels_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/978/labels{/name}","comments_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/978/comments","events_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/978/events","html_url":"https://github.com/MongoEngine/mongoengine/pull/978","id":71782277,"number":978,"title":"[fix] SortedListField: update whole list if order is changed","user":{"login":"rma4ok","id":470292,"avatar_url":"https://avatars.githubusercontent.com/u/470292?v=3","gravatar_id":"","url":"https://api.github.com/users/rma4ok","html_url":"https://github.com/rma4ok","followers_url":"https://api.github.com/users/rma4ok/followers","following_url":"https://api.github.com/users/rma4ok/following{/other_user}","gists_url":"https://api.github.com/users/rma4ok/gists{/gist_id}","starred_url":"https://api.github.com/users/rma4ok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rma4ok/subscriptions","organizations_url":"https://api.github.com/users/rma4ok/orgs","repos_url":"https://api.github.com/users/rma4ok/repos","events_url":"https://api.github.com/users/rma4ok/events{/privacy}","received_events_url":"https://api.github.com/users/rma4ok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-04-29T05:24:26Z","updated_at":"2015-04-29T17:01:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/pulls/978","html_url":"https://github.com/MongoEngine/mongoengine/pull/978","diff_url":"https://github.com/MongoEngine/mongoengine/pull/978.diff","patch_url":"https://github.com/MongoEngine/mongoengine/pull/978.patch"},"body":"In case we have document with `SortedListField` in DB and we want to update order by changing `ordering` field\r\n`SortedListField.to_mongo` returns correct sorted list\r\nBut `BaseDocument._delta` generates wrong `set_data` trying to update only specific fields at specific indexes without realizing that list order is changed and those indexes are incorrect\r\nTo fix that we make `BaseDocument._get_changed_fields` aware of `SortedListField` with `_ordering` behavior.\r\n\r\nRelated test cases are added\r\n\r\nCheers\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/mongoengine/mongoengine/978)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/comments/97505023","html_url":"https://github.com/MongoEngine/mongoengine/pull/978#issuecomment-97505023","issue_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/978","id":97505023,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2015-04-29T17:01:57Z","updated_at":"2015-04-29T17:01:57Z","body":"\n[![Coverage Status](https://coveralls.io/builds/2449861/badge)](https://coveralls.io/builds/2449861)\n\nCoverage decreased (-91.69%) to 0.0% when pulling **3e409ad86b11b9ed46b69908182f8775b950aa3c on rma4ok:master** into **42ba4a5c56a8b8c74240e4f9411a4aebf611e881 on MongoEngine:master**.\n"}}