{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/178","labels_url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/178/comments","events_url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/178/events","html_url":"https://github.com/balderdashy/sails-mysql/issues/178","id":53898852,"number":178,"title":"MySQL BIT data type causes strange behavior","user":{"login":"dcaravana","id":102935,"avatar_url":"https://avatars.githubusercontent.com/u/102935?v=3","gravatar_id":"","url":"https://api.github.com/users/dcaravana","html_url":"https://github.com/dcaravana","followers_url":"https://api.github.com/users/dcaravana/followers","following_url":"https://api.github.com/users/dcaravana/following{/other_user}","gists_url":"https://api.github.com/users/dcaravana/gists{/gist_id}","starred_url":"https://api.github.com/users/dcaravana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcaravana/subscriptions","organizations_url":"https://api.github.com/users/dcaravana/orgs","repos_url":"https://api.github.com/users/dcaravana/repos","events_url":"https://api.github.com/users/dcaravana/events{/privacy}","received_events_url":"https://api.github.com/users/dcaravana/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-09T18:29:15Z","updated_at":"2015-02-12T23:37:54Z","closed_at":"2015-02-12T23:37:54Z","body":"Values of `BIT` data type are returned as:\r\n```\r\n...\r\n    \"isVerified\": {\r\n      \"0\": 0,\r\n      \"length\": 1,\r\n      \"parent\": [\r\n        1,\r\n        0,\r\n        0,\r\n        ... lots of garbage ...\r\n        1,\r\n        0,\r\n        49,\r\n        0\r\n      ],\r\n      \"offset\": 4304\r\n    },\r\n...\r\n```\r\nindependently of the corresponding model type (either `boolean` or `integer`).\r\n\r\nIf e.g. `TINYINT(1)` is used, it works as expected instead.\r\n\r\nUsing MySQL 5.5.29, sails 0.10.5 and sails-mysql 0.10.8."},"comment":{"url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/comments/74177200","html_url":"https://github.com/balderdashy/sails-mysql/issues/178#issuecomment-74177200","issue_url":"https://api.github.com/repos/balderdashy/sails-mysql/issues/178","id":74177200,"user":{"login":"dcaravana","id":102935,"avatar_url":"https://avatars.githubusercontent.com/u/102935?v=3","gravatar_id":"","url":"https://api.github.com/users/dcaravana","html_url":"https://github.com/dcaravana","followers_url":"https://api.github.com/users/dcaravana/followers","following_url":"https://api.github.com/users/dcaravana/following{/other_user}","gists_url":"https://api.github.com/users/dcaravana/gists{/gist_id}","starred_url":"https://api.github.com/users/dcaravana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcaravana/subscriptions","organizations_url":"https://api.github.com/users/dcaravana/orgs","repos_url":"https://api.github.com/users/dcaravana/repos","events_url":"https://api.github.com/users/dcaravana/events{/privacy}","received_events_url":"https://api.github.com/users/dcaravana/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T23:37:54Z","updated_at":"2015-02-12T23:37:54Z","body":"I went deeper inside the issue: the `BIT` data type is not only 1 bit but can be [up to 64 bits](http://dev.mysql.com/doc/refman/5.0/en/bit-type.html) which mysql node.js driver [packs in a buffer](https://www.npmjs.com/package/mysql#buffer) of max 8 bytes (integers), so mapping a `boolean` to a `BIT` is basically wrong from a semantic standpoint (and this is why `BOOL` data type is a [synonym for `TINYINT(1)` to MySQL](http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html)).\r\n\r\nAnd this is also why #128 is potentially wrong (or not if we want to assume that a `boolean` corresponds to a `BIT(1)`).\r\n\r\nClosing this issue as it can be considered invalid."}}