{"action":"closed","issue":{"url":"https://api.github.com/repos/Scille/umongo/issues/137","repository_url":"https://api.github.com/repos/Scille/umongo","labels_url":"https://api.github.com/repos/Scille/umongo/issues/137/labels{/name}","comments_url":"https://api.github.com/repos/Scille/umongo/issues/137/comments","events_url":"https://api.github.com/repos/Scille/umongo/issues/137/events","html_url":"https://github.com/Scille/umongo/issues/137","id":347815340,"node_id":"MDU6SXNzdWUzNDc4MTUzNDA=","number":137,"title":"Ability to add unique compound index","user":{"login":"akolechkin","id":100084,"node_id":"MDQ6VXNlcjEwMDA4NA==","avatar_url":"https://avatars0.githubusercontent.com/u/100084?v=4","gravatar_id":"","url":"https://api.github.com/users/akolechkin","html_url":"https://github.com/akolechkin","followers_url":"https://api.github.com/users/akolechkin/followers","following_url":"https://api.github.com/users/akolechkin/following{/other_user}","gists_url":"https://api.github.com/users/akolechkin/gists{/gist_id}","starred_url":"https://api.github.com/users/akolechkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akolechkin/subscriptions","organizations_url":"https://api.github.com/users/akolechkin/orgs","repos_url":"https://api.github.com/users/akolechkin/repos","events_url":"https://api.github.com/users/akolechkin/events{/privacy}","received_events_url":"https://api.github.com/users/akolechkin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-06T07:50:12Z","updated_at":"2018-08-22T12:56:54Z","closed_at":"2018-08-22T12:56:54Z","author_association":"NONE","body":"It's useful to be able to define two or more fields as single index. \r\nSample from the official documentation: https://docs.mongodb.com/manual/core/index-unique/#unique-compound-index.\r\n\r\nthe use-case:\r\n\r\n```\r\nclass Book(Document):\r\n\r\n    author = StrField()\r\n    title = StrField()\r\n    pages = IntField()\r\n\r\n    class Meta:\r\n        indexes = ('pages',)\r\n        unique_indexes = (('author', 'title'),)\r\n```\r\n\r\nInternally we can modify the original parse_index function https://github.com/Scille/umongo/blob/master/umongo/indexes.py#L20 and pass unique argument into that function, and then parse those two attributes from Meta in builder just like we do for unique/non unique indexes from fields in _collect_indexes https://github.com/Scille/umongo/blob/master/umongo/builder.py#L59"}}
{"actor":{"display_login":"touilleMan"}}