{"id":3238,"date":"2016-03-06T21:56:31","date_gmt":"2016-03-06T21:56:31","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3238"},"modified":"2016-03-06T21:56:31","modified_gmt":"2016-03-06T21:56:31","slug":"rethinkdb-in-list-example","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/rethinkdb-in-list-example\/","title":{"rendered":"RethinkDB: IN List example"},"content":{"rendered":"<p>RethinkDB has an interesting syntax for doing IN lists, where the IN list comes before the column:<\/p>\n<pre lang=\"javascript\">r.db('test')\n .table('users')\n .filter( \n    (doc) =&gt; \n      r.expr(['test', 'sieling'])\n       .contains(doc('last_name')\n ) \n)<\/pre>\n<table class=\"json_table\">\n<tbody>\n<tr class=\"jta_tr\">\n<td class=\"td_attr col-record col-record-attr\" data-col=\"record\"><\/td>\n<td class=\"td_attr col-0\" data-col=\"0\">\n<div class=\"click_detector\">\n<div class=\"jta_attr value-0\">first_name<\/div>\n<\/div>\n<\/td>\n<td class=\"td_attr col-1\" data-col=\"1\">\n<div class=\"click_detector\">\n<div class=\"jta_attr value-1\">id<\/div>\n<\/div>\n<\/td>\n<td class=\"td_attr col-2\" data-col=\"2\">\n<div class=\"click_detector\">\n<div class=\"jta_attr value-2\">last_name<\/div>\n<\/div>\n<\/td>\n<td class=\"td_attr col-3\" data-col=\"3\">\n<div class=\"click_detector\">\n<div class=\"jta_attr value-3\">user_name<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr class=\"jta_tr\">\n<td class=\"col-record-td\" data-col=\"record\">\n<div class=\"jta_value col-record\">1<\/div>\n<\/td>\n<td class=\"col-0\" data-col=\"0\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-0 jta_string\">gary<\/div>\n<\/div>\n<\/td>\n<td class=\"col-1\" data-col=\"1\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-1 jta_string\">903e0943-8ffe-41ca-a22f-7b1a964b399d<\/div>\n<\/div>\n<\/td>\n<td class=\"col-2\" data-col=\"2\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-2 jta_string\">sieling<\/div>\n<\/div>\n<\/td>\n<td class=\"col-3\" data-col=\"3\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-3 jta_string\">gsieling<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr class=\"jta_tr\">\n<td class=\"col-record-td\" data-col=\"record\">\n<div class=\"jta_value col-record\">2<\/div>\n<\/td>\n<td class=\"col-0\" data-col=\"0\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-0 jta_string\">gary<\/div>\n<\/div>\n<\/td>\n<td class=\"col-1\" data-col=\"1\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-1 jta_string\">479e9ce1-e0bb-46b3-a65f-554ac237460a<\/div>\n<\/div>\n<\/td>\n<td class=\"col-2\" data-col=\"2\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-2 jta_string\">sieling<\/div>\n<\/div>\n<\/td>\n<td class=\"col-3\" data-col=\"3\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-3 jta_string\">gsieling<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr class=\"jta_tr\">\n<td class=\"col-record-td\" data-col=\"record\">\n<div class=\"jta_value col-record\">3<\/div>\n<\/td>\n<td class=\"col-0\" data-col=\"0\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-0 jta_string\">test<\/div>\n<\/div>\n<\/td>\n<td class=\"col-1\" data-col=\"1\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-1 jta_string\">1b223750-799d-402a-b378-74c993a9c10c<\/div>\n<\/div>\n<\/td>\n<td class=\"col-2\" data-col=\"2\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-2 jta_string\">test<\/div>\n<\/div>\n<\/td>\n<td class=\"col-3\" data-col=\"3\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-3 jta_string\">test<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr class=\"jta_tr\">\n<td class=\"col-record-td\" data-col=\"record\">\n<div class=\"jta_value col-record\">4<\/div>\n<\/td>\n<td class=\"col-0\" data-col=\"0\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-0 jta_string\">gary<\/div>\n<\/div>\n<\/td>\n<td class=\"col-1\" data-col=\"1\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-1 jta_string\">947a3ce6-d419-4d31-bd1e-874c721a9e6c<\/div>\n<\/div>\n<\/td>\n<td class=\"col-2\" data-col=\"2\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-2 jta_string\">sieling<\/div>\n<\/div>\n<\/td>\n<td class=\"col-3\" data-col=\"3\">\n<div class=\"click_detector\">\n<div class=\"jta_value value-3 jta_string\">gsieling<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>One nice thing about this is that there doesn&#8217;t seem to be a length limit &#8211; in Oracle, IN lists are arbitrarily capped at 1,000 entries. <\/p>\n<p>In testing this, I did find that at some point the RethinkDB UI gets harder to use and may crash the browser. But it seems to retain it&#8217;s memory of what you had in your query, so it recovers much more easily than older tools<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RethinkDB has an interesting syntax for doing IN lists, where the IN list comes before the column: r.db(&#8216;test&#8217;) .table(&#8216;users&#8217;) .filter( (doc) =&gt; r.expr([&#8216;test&#8217;, &#8216;sieling&#8217;]) .contains(doc(&#8216;last_name&#8217;) ) ) first_name id last_name user_name 1 gary 903e0943-8ffe-41ca-a22f-7b1a964b399d sieling gsieling 2 gary 479e9ce1-e0bb-46b3-a65f-554ac237460a sieling gsieling 3 test 1b223750-799d-402a-b378-74c993a9c10c test test 4 gary 947a3ce6-d419-4d31-bd1e-874c721a9e6c sieling gsieling One nice thing about &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/rethinkdb-in-list-example\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RethinkDB: IN List example&#8221;<\/span><\/a><\/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\/3238"}],"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=3238"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3238\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}