{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6017","repository_url":"https://api.github.com/repos/rethinkdb/rethinkdb","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6017/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6017/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6017/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/6017","id":168439424,"number":6017,"title":"Add native Reql hash function","user":{"login":"internalfx","id":583701,"avatar_url":"https://avatars.githubusercontent.com/u/583701?v=3","gravatar_id":"","url":"https://api.github.com/users/internalfx","html_url":"https://github.com/internalfx","followers_url":"https://api.github.com/users/internalfx/followers","following_url":"https://api.github.com/users/internalfx/following{/other_user}","gists_url":"https://api.github.com/users/internalfx/gists{/gist_id}","starred_url":"https://api.github.com/users/internalfx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/internalfx/subscriptions","organizations_url":"https://api.github.com/users/internalfx/orgs","repos_url":"https://api.github.com/users/internalfx/repos","events_url":"https://api.github.com/users/internalfx/events{/privacy}","received_events_url":"https://api.github.com/users/internalfx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-30T00:48:53Z","updated_at":"2016-07-30T02:11:11Z","closed_at":null,"body":"I've written a library called [Thinker](https://github.com/internalfx/thinker) for quickly synchronizing two databases locally or over a network.\r\n\r\nTo decide what records to copy I use this query...\r\n\r\n```javascript\r\n    r.db(sourceDB).table(table).orderBy({index: r.asc('id')})\r\n      .map(function (row) { return {id: row('id'), raw: row.toJSON()} })\r\n      .map(r.js(`(function (data) {\r\n        // JS hash function here\r\n        return {id: data.id, hash: hash(data.raw)}\r\n      })`))\r\n      .run({cursor: true})\r\n```\r\n\r\nI have to imagine that it would be far more performant if I could do this...\r\n\r\n```javascript\r\n    r.db(sourceDB).table(table).orderBy({index: r.asc('id')})\r\n      .map(function (row) { return {id: row('id'), raw: r.hash(row.toJSON())} })\r\n      .run({cursor: true})\r\n```"},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/236333682","html_url":"https://github.com/rethinkdb/rethinkdb/issues/6017#issuecomment-236333682","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6017","id":236333682,"user":{"login":"deontologician","id":1366,"avatar_url":"https://avatars.githubusercontent.com/u/1366?v=3","gravatar_id":"","url":"https://api.github.com/users/deontologician","html_url":"https://github.com/deontologician","followers_url":"https://api.github.com/users/deontologician/followers","following_url":"https://api.github.com/users/deontologician/following{/other_user}","gists_url":"https://api.github.com/users/deontologician/gists{/gist_id}","starred_url":"https://api.github.com/users/deontologician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deontologician/subscriptions","organizations_url":"https://api.github.com/users/deontologician/orgs","repos_url":"https://api.github.com/users/deontologician/repos","events_url":"https://api.github.com/users/deontologician/events{/privacy}","received_events_url":"https://api.github.com/users/deontologician/received_events","type":"User","site_admin":false},"created_at":"2016-07-30T02:11:11Z","updated_at":"2016-07-30T02:11:11Z","body":"Try this:\r\n\r\n```js\r\nr.db(sourceDB).table(table).orderBy({index: r.asc('id')})\r\n      .map(function (row) { return {id: row('id'), raw: r.uuid(row.toJSON())} })\r\n      .run({cursor: true})\r\n```"}}
{"actor":{"display_login":"deontologician"}}