{"action":"opened","issue":{"url":"https://api.github.com/repos/ryanfitz/vogels/issues/195","repository_url":"https://api.github.com/repos/ryanfitz/vogels","labels_url":"https://api.github.com/repos/ryanfitz/vogels/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/ryanfitz/vogels/issues/195/comments","events_url":"https://api.github.com/repos/ryanfitz/vogels/issues/195/events","html_url":"https://github.com/ryanfitz/vogels/issues/195","id":190489516,"number":195,"title":"conditional write with multiple constraints","user":{"login":"simoami","id":2038264,"avatar_url":"https://avatars.githubusercontent.com/u/2038264?v=3","gravatar_id":"","url":"https://api.github.com/users/simoami","html_url":"https://github.com/simoami","followers_url":"https://api.github.com/users/simoami/followers","following_url":"https://api.github.com/users/simoami/following{/other_user}","gists_url":"https://api.github.com/users/simoami/gists{/gist_id}","starred_url":"https://api.github.com/users/simoami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simoami/subscriptions","organizations_url":"https://api.github.com/users/simoami/orgs","repos_url":"https://api.github.com/users/simoami/repos","events_url":"https://api.github.com/users/simoami/events{/privacy}","received_events_url":"https://api.github.com/users/simoami/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-19T10:35:40Z","updated_at":"2016-11-19T10:35:40Z","closed_at":null,"body":"Hello,\r\nI'd like to know if it's possible to use the overwrite flag with constraints on the hash key and 2 index attributes. \r\n\r\nconsider my model:\r\n\r\n```\r\nvar UserModel = db.instance.define('user', {\r\n  hashKey: 'id',\r\n  schema: {\r\n    id: db.instance.types.uuid(),\r\n    cognitoId: Joi.string(),\r\n    email: Joi.string()\r\n  },\r\n  indexes: [\r\n    { hashKey: 'email', type: 'global', name: 'emailIndex' },\r\n    { hashKey: 'cognitoId', type: 'global', name: 'cognitoIdIndex' }\r\n  ],\r\n  tableName: 'users'\r\n});\r\n```\r\n\r\nWould `User.create(user, {overwrite : false}, cb)` be enough to prevent duplicate id, cognitoId and email? or do I need to explicitly construct an array of conditional expressions to cover all 3? Do perhaps I could redefine the model in a way that `overwrite` works?"}}
{"actor":{"display_login":"simoami"}}