{"comment":{"url":"https://api.github.com/repos/michalmuskala/mongodb_ecto/comments/11405712","html_url":"https://github.com/michalmuskala/mongodb_ecto/commit/56006fe508c422c8b2f6ff127625cd47c01dda4a#commitcomment-11405712","id":11405712,"user":{"login":"michalmuskala","id":477062,"avatar_url":"https://avatars.githubusercontent.com/u/477062?v=3","gravatar_id":"","url":"https://api.github.com/users/michalmuskala","html_url":"https://github.com/michalmuskala","followers_url":"https://api.github.com/users/michalmuskala/followers","following_url":"https://api.github.com/users/michalmuskala/following{/other_user}","gists_url":"https://api.github.com/users/michalmuskala/gists{/gist_id}","starred_url":"https://api.github.com/users/michalmuskala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalmuskala/subscriptions","organizations_url":"https://api.github.com/users/michalmuskala/orgs","repos_url":"https://api.github.com/users/michalmuskala/repos","events_url":"https://api.github.com/users/michalmuskala/events{/privacy}","received_events_url":"https://api.github.com/users/michalmuskala/received_events","type":"User","site_admin":false},"position":33,"line":110,"path":"lib/mongodb_ecto.ex","commit_id":"56006fe508c422c8b2f6ff127625cd47c01dda4a","created_at":"2015-05-28T12:24:51Z","updated_at":"2015-05-28T12:24:51Z","body":"I will need to tackle that. Each type is tagged differently by the driver:\r\n* float is float\r\n* string is a utf8 binary\r\n* documents are tuples of even number of elements (alternating key, value)\r\n* arrays are lists - erlang strings are treated as lists of integers\r\n* binary data are tuple `{:bin, :bin, data}`\r\n* uuid is a tuple `{:bin, :uuid, data}`\r\n* objectid is a tuple `{<<value :: size(96)>>}`\r\n* boolean is `true` or `false`\r\n* date is unix time in `:erlang.now` format\r\n* null is `:null`\r\n* regex is a tuple `{:regex, pattern, options}` - pattern and options are utf8 encoded binaries\r\n* javascript is a tuple `{:javascript, scope, source}` - scope is bson document, source is utf8 encoded binary\r\n* symbols are atoms\r\n* integers are integers\r\n* timestamp (internal mongodb timestamp) is a tuple `{:mongostamp, timestamp, ordinal}` - timestamp is unix timestamp (4 byte), and ordinal is number of operation at that second (also 4 byte).\r\n* minkey and maxkey are respectively atoms `:MINKEY` and `:MAXKEY`\r\n\r\nThis is based on comparison of [MongoDB docs](http://docs.mongodb.org/manual/reference/bson-types/) and [bson-erlang library docs](http://api.mongodb.org/erlang/bson/)\r\n\r\nThe driver also supports types not listed in MongoDB documentation:\r\n* bfunction - a tuple `{:bin, :function, binary}`\r\n* md5 - a tuple `{:bin, :md5, binary}`\r\n* userdefined - a tuple `{:bin, :userdefined, binary}`\r\n\r\nCurrently I'm just handling basic types - integers and strings and adding next types as I try to make next tests to pass."}}