{"id":3289,"date":"2016-03-07T03:30:34","date_gmt":"2016-03-07T03:30:34","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3289"},"modified":"2016-03-07T03:30:34","modified_gmt":"2016-03-07T03:30:34","slug":"rethinkdb-union-example-2","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/rethinkdb-union-example-2\/","title":{"rendered":"RethinkDB: UNION example"},"content":{"rendered":"<p>To do a UNION query in RethinkDB, you&#8217;ll need to identify your two datasets, combine them, and then manually de-duplicate the results:<\/p>\n<pre lang=\"javascript\">\nr.db('test')\n .table('users')\n .filter( (x) => x('user_name').match('test ') )\n .union(\n   r.db('test')\n    .table('users')\n    .filter(\n      (x) => x('user_name').match('9')\n    )\n )\n .distinct()\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To do a UNION query in RethinkDB, you&#8217;ll need to identify your two datasets, combine them, and then manually de-duplicate the results: r.db(&#8216;test&#8217;) .table(&#8216;users&#8217;) .filter( (x) => x(&#8216;user_name&#8217;).match(&#8216;test &#8216;) ) .union( r.db(&#8216;test&#8217;) .table(&#8216;users&#8217;) .filter( (x) => x(&#8216;user_name&#8217;).match(&#8216;9&#8217;) ) ) .distinct()<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[160,462,466,523],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3289"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=3289"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3289\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}