{"issue":{"state":"open","pull_request":{"diff_url":"https://github.com/django-mongodb-engine/mongodb-engine/pull/80.diff","html_url":"https://github.com/django-mongodb-engine/mongodb-engine/pull/80","patch_url":"https://github.com/django-mongodb-engine/mongodb-engine/pull/80.patch"},"user":{"avatar_url":"https://secure.gravatar.com/avatar/1b6429aafe9e31ea3e3586e2edf80211?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1b6429aafe9e31ea3e3586e2edf80211","url":"https://api.github.com/users/maraujop","login":"maraujop","id":252257},"milestone":null,"labels":[],"assignee":null,"updated_at":"2011-11-01T14:17:43Z","closed_at":null,"comments":10,"url":"https://api.github.com/repos/django-mongodb-engine/mongodb-engine/issues/80","body":"When you allow null in a unique field, you expect to be able to introduce several nulls in that column field. This generates the sparse indexes automatically. Otherwise you can forget to create the indexes and get bitten by it in the future.","html_url":"https://github.com/django-mongodb-engine/mongodb-engine/issues/80","number":80,"title":"Automatically create sparse indexes in unique and null fields","id":2108426,"created_at":"2011-11-01T09:14:07Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/24cbd9ecaace7e42aa7a1bd914ed019f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"24cbd9ecaace7e42aa7a1bd914ed019f","url":"https://api.github.com/users/jonashaag","login":"jonashaag","id":175722},"updated_at":"2011-11-01T14:17:43Z","url":"https://api.github.com/repos/django-mongodb-engine/mongodb-engine/issues/comments/2590723","body":"Still I'm not convinced that we should implicitly create sparse indexes here. Indices are a complex topic -- we should not assume anything at all.\r\n\r\nMaybe we reached the limit of what's possible adapting MongoDB to SQL databases. That's fine and we should not put up with unexpected behavior only to make code run out of the box.\r\n\r\nIf the \"leave out keys\" thing works we should implement that in a more generalized way (always leave out empty fields, independent of indices). We'd need to investigate in how that interferes with default values (and changing the default value after saves), compared to a SQL database. And then we could add a troubleshooting note to the docs explaining why things work differently and how to fix it (using a sparse index).","id":2590723,"created_at":"2011-11-01T14:17:43Z"}}