{"id":3259,"date":"2016-03-07T01:56:48","date_gmt":"2016-03-07T01:56:48","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3259"},"modified":"2016-03-07T01:56:48","modified_gmt":"2016-03-07T01:56:48","slug":"rethinkdb-starts-example","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/rethinkdb-starts-example\/","title":{"rendered":"RethinkDB: Starts with example"},"content":{"rendered":"<p>RethinkDB filters work on regular expressions. To do starts with queries, you can match the regular expression on the start of the data:<\/p>\n<pre lang=\"javascript\">r.db('test')\n .table('users')\n  .filter( (doc) =&gt; doc('user_name').match(\"^.*ielin\") )\n<\/pre>\n<p>Note that the end isn&#8217;t matched, so it will include results with various ends.<\/p>\n<div id=\"sticky-wrap\">\n<div id=\"main-container\">\n<div id=\"cluster\" class=\"container\">\n<div id=\"dataexplorer\">\n<div class=\"section\">\n<div class=\"results_container\">\n<div class=\"result_view\">\n<div class=\"results_header\">\n<p class=\"metadata  feed_paused\">1 row returned. Displaying rows 1-1<\/p>\n<\/div>\n<div class=\"tab-content\">\n<div class=\"results table_view_container\">\n<div class=\"results_wrap table_view\">\n<div class=\"json_table_container\">\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\">72b719a2-0a96-4b54-aaba-63b76e5c3c75<\/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<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"footer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>RethinkDB filters work on regular expressions. To do starts with queries, you can match the regular expression on the start of the data: r.db(&#8216;test&#8217;) .table(&#8216;users&#8217;) .filter( (doc) =&gt; doc(&#8216;user_name&#8217;).match(&#8220;^.*ielin&#8221;) ) Note that the end isn&#8217;t matched, so it will include results with various ends. 1 row returned. Displaying rows 1-1 first_name id last_name user_name 1 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/rethinkdb-starts-example\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RethinkDB: Starts with 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":[1],"tags":[],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3259"}],"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=3259"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3259\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}