{"id":3325,"date":"2016-03-08T02:36:58","date_gmt":"2016-03-08T02:36:58","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=3325"},"modified":"2016-03-08T02:36:58","modified_gmt":"2016-03-08T02:36:58","slug":"rethinkdb-fixing-error-e-object-field-title-may-not-undefined","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/rethinkdb-fixing-error-e-object-field-title-may-not-undefined\/","title":{"rendered":"RethinkDB: Fixing error &#8220;e: Object field &#8216;Title&#8217; may not be undefined&#8221;"},"content":{"rendered":"<p>If you access data values incorrectly, you may get an error like so:<\/p>\n<pre>\nObject field 'Title' may not be undefined\n<\/pre>\n<p>Here is an example of what not to do:<\/p>\n<pre lang=\"javascript\">\nr.db('test')\n .table('salaries')\n .group('role', 'level')\n .sum('salary')\n .ungroup()\n .map( (x) => {\n    return {\n    Title: x('group')[0],\n    Level: x('group')[1],\n    Value: x('reduction')\n}})\n<\/pre>\n<p>Remember that RethinkDB wants you to access everything through function calls, since it needs this for cross-language support. To fix this error, you access the arrays with function calls, like so:<\/p>\n<pre lang=\"javascript\">\n<pre lang=\"javascript\">\nr.db('test')\n .table('salaries')\n .group('role', 'level')\n .sum('salary')\n .ungroup()\n .map( (x) => {\n    return {\n    Title: x('group')(0),\n    Level: x('group')(1),\n    Value: x('reduction')\n}})\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you access data values incorrectly, you may get an error like so: Object field &#8216;Title&#8217; may not be undefined Here is an example of what not to do: r.db(&#8216;test&#8217;) .table(&#8216;salaries&#8217;) .group(&#8216;role&#8217;, &#8216;level&#8217;) .sum(&#8216;salary&#8217;) .ungroup() .map( (x) => { return { Title: x(&#8216;group&#8217;)[0], Level: x(&#8216;group&#8217;)[1], Value: x(&#8216;reduction&#8217;) }}) Remember that RethinkDB wants you to access &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/rethinkdb-fixing-error-e-object-field-title-may-not-undefined\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RethinkDB: Fixing error &#8220;e: Object field &#8216;Title&#8217; may not be undefined&#8221;&#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":[9],"tags":[160,302,462,466,523],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3325"}],"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=3325"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/3325\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=3325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=3325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=3325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}