Updated blog post and deps
the_architech -
r80:604f5df25d14 primary
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -2,7 +2,7
2 <feed xmlns="http://www.w3.org/2005/Atom">
2 <feed xmlns="http://www.w3.org/2005/Atom">
3 <id>https://blog.webb.page/</id>
3 <id>https://blog.webb.page/</id>
4 <title>the Webb blog</title>
4 <title>the Webb blog</title>
5 <updated>2020-02-27T07:32:34.371Z</updated>
5 <updated>2020-04-09T18:10:12.191Z</updated>
6 <generator>The 'Net</generator>
6 <generator>The 'Net</generator>
7 <author>
7 <author>
8 <name>Paul Anthony Webb</name>
8 <name>Paul Anthony Webb</name>
@@ -154,19 +154,18 r.db(&quot;dawebb&quot;).table(&quot;posts&quot;).index_create(&quot;slug&quot;)
154 <p>Now let&#39;s update our time-based fields:</p>
154 <p>Now let&#39;s update our time-based fields:</p>
155 <pre><code class="language-js">// Command
155 <pre><code class="language-js">// Command
156 r.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).update({
156 r.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).update({
157 created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),
157 created: r.ISO8601(r.row(&quot;created&quot;)),
158 updated: r.iso8601(r.row[&quot;updated&quot;]).to_iso8601()
158 updated: r.ISO8601(r.row(&quot;updated&quot;))
159 });
159 });
160
160
161 // Examples
161 // Examples
162 r.db(&quot;dawebb&quot;).table(&quot;users&quot;).update({
162 r.db(&quot;dawebb&quot;).table(&quot;users&quot;).update({
163 created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),
163 created: r.ISO8601(r.row(&quot;created&quot;)),
164 updated: r.iso8601(r.row[&quot;updated&quot;]).to_iso8601()
164 updated: r.ISO8601(r.row(&quot;updated&quot;))
165 });
165 });
166
166
167 r.db(&quot;dawebb&quot;).table(&quot;visits&quot;).update({
167 r.db(&quot;dawebb&quot;).table(&quot;visits&quot;).update({
168 created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),
168 timestamp: r.ISO8601(r.row(&quot;timestamp&quot;))
169 timestamp: r.iso8601(r.row[&quot;timestamp&quot;]).to_iso8601()
170 });</code></pre>
169 });</code></pre>
171 <h2 id="fin">FIN</h2>
170 <h2 id="fin">FIN</h2>
172 <p>And there you have it! A super easy guide to move from MongoDB to RethinkDB. I&#39;ve been using RethinkDB for several months now and I am way happier than I was with MongoDB. While super easy to get into, once you get in too deep it becomes an exercise in frustration to find solutions to ambiguous errors and the MongoDB docs are not user-friendly.</p>
171 <p>And there you have it! A super easy guide to move from MongoDB to RethinkDB. I&#39;ve been using RethinkDB for several months now and I am way happier than I was with MongoDB. While super easy to get into, once you get in too deep it becomes an exercise in frustration to find solutions to ambiguous errors and the MongoDB docs are not user-friendly.</p>
@@ -25,7 +25,7
25 },
25 },
26 {
26 {
27 "id": "https://blog.webb.page/2020/migrating-from-mongo-to-rethink",
27 "id": "https://blog.webb.page/2020/migrating-from-mongo-to-rethink",
28 "content_html": "<p>RethinkDB, seemingly on life support for quite some time, is seeing a <a href=\"https://rethinkdb.com/blog/2.4.0-release\" title=\"Announcing RethinkDB 2.4.0: Night Of The Living Dead\">revival</a> of sorts. As such, I thought it prudent to make available evergreen content for my favorite database these days. If you are interested in trying RethinkDB you can check out <a href=\"https://pusher.com/tutorials/live-node-rethinkdb\" title=\"How to build a realtime application with Node.js and RethinkDB\">these</a> <a href=\"https://www.pluralsight.com/guides/a-practical-introduction-to-rethinkdb\" title=\"A Practical Introduction to RethinkDB\">two</a> tutorials (my guide will not cover installation or setup).</p>\n<h2 id=\"preparing-mongodb-exports\">Preparing MongoDB exports</h2>\n<pre><code class=\"language-sh\"># Command\nmongoexport --port PORT_NUMBER --db DATABASE_NAME --collection COLLECTION_NAME --out COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json --pretty --jsonArray \n\n# Example\nmongoexport --port 98765 --db dawebb --collection users --out users-`date &quot;+%Y-%m-%d&quot;`.json --pretty --jsonArray</code></pre>\n<p>There&#39;s a bit to unpack here so I&#39;ll break it down. Keep in mind that all the parameters yelling at you are <em>placeholders</em> (for you to replace with your own parameters).</p>\n<p>Actually, the placeholders are self-explanatory but the second half of the command is interesting.</p>\n<p><code>COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json</code> makes it so the exported collection looks like <code>users-2020-01-24.json</code>, with the date being whenever you ran the above command. Super nifty for backups too.</p>\n<p>The <code>--pretty</code> flag isn&#39;t necessary for the import into RethinkDB to work, it&#39;s for <strong>you</strong> to inspect the export for any reason.</p>\n<p><a href=\"https://docs.mongodb.com/manual/reference/program/mongoexport/#cmdoption-mongoexport-jsonarray\" title=\"MongoDB reference about the &#39;jsonArray&#39; flag\">The last flag</a>, <code>--jsonArray</code>, is the most important. For <em>some reason</em>, MongoDB exports each item in a collection as its own object <strong>not</strong> separated by commas. Maybe MongoDB&#39;s import process doesn&#39;t choke on malformed JSON but everything else does. <code>--jsonArray</code> puts the contents of the export into a single JSON array. Like you&#39;d expect by default...maybe that&#39;s just me.</p>\n<p>NOTE: <code>--out</code> is the destination path so if you haven&#39;t prefaced <code>COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json</code> with a path, the export will be in your home directory.</p>\n<p>Anyhoo once you&#39;ve exported the collections you care about, SFTP into that server to grab them and place them on your Desktop so you don&#39;t have a brain fart and forget where you put them moments later.</p>\n<h2 id=\"migrating-phase-01\">Migrating, phase 01</h2>\n<p>MongoDB comes with some oddities that you may not want in your new database. Notably, how it deals with IDs. Here&#39;s an example:</p>\n<pre><code class=\"language-json\">{\n &quot;_id&quot;: {\n &quot;$oid&quot;: &quot;6bf9b676c24869077c37f61e&quot;\n },\n &quot;admin&quot;: true,\n &quot;dashboard&quot;: [],\n &quot;language&quot;: &quot;en_US&quot;,\n &quot;loginMethod&quot;: &quot;link&quot;,\n &quot;nameFirst&quot;: &quot;&quot;,\n &quot;nameLast&quot;: &quot;&quot;,\n &quot;plan&quot;: &quot;free&quot;,\n &quot;summaries&quot;: [],\n &quot;timezone&quot;: &quot;gmt-05-02&quot;,\n &quot;verified&quot;: true,\n &quot;email&quot;: &quot;user@domain.tld&quot;,\n &quot;__v&quot;: 0\n}</code></pre>\n<p>In RethinkDB IDs are simply <code>id</code> and you have no need for <code>__v</code> so you probably don&#39;t want these values in your shiny new database. Also, you may have decided to use this migration period switch up your schema. Combine <code>nameFirst</code> with <code>nameLast</code>? Drop <code>plan</code>? Update <code>timzeone</code>? Replace <code>createdAt</code> with <code>created</code>? Regardless, you&#39;re gonna need to do a bit of legwork to clean your MongoDB export(s).</p>\n<p>The entire script I use is hosted <a href=\"https://gist.github.com/NetOperatorWibby/5084bf5c64306093e067fc43cfa4fcdb\" title=\"MongoDB to RethinkDB migration script\">here</a> but I&#39;ll point out some relevant pieces.</p>\n<p>If you have any fields with dates/milliseconds, your import will fail unless you wrap those fields in <code>new Date</code> like so:</p>\n<pre><code class=\"language-json\">…,\ntimestamp: new Date(timestamp),\n…,</code></pre>\n<p>To reuse the IDs that were generated in MongoDB for usage in RethinkDB, you&#39;re gonna need to do something like this:</p>\n<pre><code class=\"language-json\">…,\nid: record._id[&quot;$oid&quot;],\n…,</code></pre>\n<p>You&#39;ll also need to make sure to explicity select the fields you want to transfer into your new export. The gist linked above should answer remaining questions you may have.</p>\n<h2 id=\"importing-into-rethinkdb\">Importing into RethinkDB</h2>\n<p>Even though you&#39;ve already installed RethinkDB, you need to install <a href=\"https://rethinkdb.com/docs/install-drivers/python\" title=\"RethinkDB Python driver installation instructions\">the Python driver</a> as well (for importing functionality, at least I had to do this for macOS).</p>\n<p>Also, make sure you are importing your newly processed/migrated data into RethinkDB, not the original nonsense from your MongoDB export (unless of course, that&#39;s your plan).</p>\n<pre><code class=\"language-sh\"># Command\nrethinkdb import -f PATH_TO_PROCESSED_EXPORT_FILE --table DATABASE.TABLE -c CONNECTION_URL --password-file PASSWORD_FILE --force\n\n# Example\nrethinkdb import -f ~/Desktop/migrated/users-2020-01-24.json --table dawebb.users -c localhost:98765 --password-file ~/Desktop/rethinkpass.txt --force </code></pre>\n<p>If you don&#39;t have a password on your RethinkDB database, you can safely omit the <code>--password-file</code> flag. Otherwise, make sure the password file only contains the password. If your IDE automatically generates new lines in files, just create the password file with <code>nano</code>.</p>\n<p>Make sure you run the above command while RethinkDB is running and you&#39;ll see freshly created tables successfully created.</p>\n<h2 id=\"migrating-phase-02\">Migrating, phase 02</h2>\n<p>Alright, we&#39;re almost at the finish line!</p>\n<p>One of the neat things about RethinkDB (and a feature that convinced me to make the jump) is its Data Explorer. It&#39;s a UI that allows you to manipulate or check out your tables. There are just two remaining things we need to do and they&#39;re quick and easy: 1) set up indexes for our tables and 2) update time-based data to a format RethinkDB <em>really</em> likes.</p>\n<p>Visit <code>http://localhost:8080</code> (default port, unless you changed it) and click on &quot;Data Explorer&quot; in the header. In the text field you&#39;ll be able to perform queries using JavaScript.</p>\n<h3 id=\"setting-up-indexes\">Setting up indexes</h3>\n<p>By default <code>id</code> is an index but you may want more. Indexes are for fields with unique values so it&#39;s easy to think of which field(s) would be suitable.</p>\n<p>Sometimes, only the ID would be unique and that&#39;s fine.</p>\n<pre><code class=\"language-js\">// Command\nr.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).index_create(&quot;FIELD_WITH_UNIQUE_VALUE&quot;); \n\n// Examples\nr.db(&quot;dawebb&quot;).table(&quot;users&quot;).index_create(&quot;email&quot;);\nr.db(&quot;dawebb&quot;).table(&quot;posts&quot;).index_create(&quot;slug&quot;);</code></pre>\n<p>Now let&#39;s update our time-based fields:</p>\n<pre><code class=\"language-js\">// Command\nr.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).update({\n created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),\n updated: r.iso8601(r.row[&quot;updated&quot;]).to_iso8601()\n});\n\n// Examples\nr.db(&quot;dawebb&quot;).table(&quot;users&quot;).update({\n created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),\n updated: r.iso8601(r.row[&quot;updated&quot;]).to_iso8601()\n});\n\nr.db(&quot;dawebb&quot;).table(&quot;visits&quot;).update({\n created: r.iso8601(r.row[&quot;created&quot;]).to_iso8601(),\n timestamp: r.iso8601(r.row[&quot;timestamp&quot;]).to_iso8601() \n});</code></pre>\n<h2 id=\"fin\">FIN</h2>\n<p>And there you have it! A super easy guide to move from MongoDB to RethinkDB. I&#39;ve been using RethinkDB for several months now and I am way happier than I was with MongoDB. While super easy to get into, once you get in too deep it becomes an exercise in frustration to find solutions to ambiguous errors and the MongoDB docs are not user-friendly.</p>\n<p>Contrast that with RethinkDB&#39;s Data Explorer, clear error messages, and clean documentation and it&#39;s not difficult to imagine why I&#39;d make the switch. 🕸</p>\n<p>P.S. New year, <a href=\"https://socii.network/NetOpWibby/status/e3HWCaoqTZYzZvZ47RXfp\" title=\"Sneak peek at codebase\">new projects</a>, and now I feel like I need a new design for this blog. And then I remembered that first I need to create a <a href=\"/2019/a-personal-api\" title=\"A Personal API\">personal API</a> so this blog can just become the presentation layer for the content.</p>\n<p><strong><em>2020.01.30 update</em></strong></p>\n<blockquote>\n<p>Another reason to migrate is the license of MongoDB: SSPL vs. Apache 2 of RethinkDB.<br/>— <a href=\"https://lobste.rs/u/af\">af</a></p>\n</blockquote>\n<p>For others who may not know what <a href=\"https://lukasatkinson.de/2019/mongodb-no-longer-seeks-osi-approval-for-sspl\">SSPL</a> entails (like me until I read the linked post):</p>\n<p>Basically, SSPL means one cannot offer MongoDB as a hosted service. That makes sense from their end as they offer hosting. However, it&#39;s a bit of a punk move because they are preventing potential competition from forcing them to improve their product.</p>\n",
28 "content_html": "<p>RethinkDB, seemingly on life support for quite some time, is seeing a <a href=\"https://rethinkdb.com/blog/2.4.0-release\" title=\"Announcing RethinkDB 2.4.0: Night Of The Living Dead\">revival</a> of sorts. As such, I thought it prudent to make available evergreen content for my favorite database these days. If you are interested in trying RethinkDB you can check out <a href=\"https://pusher.com/tutorials/live-node-rethinkdb\" title=\"How to build a realtime application with Node.js and RethinkDB\">these</a> <a href=\"https://www.pluralsight.com/guides/a-practical-introduction-to-rethinkdb\" title=\"A Practical Introduction to RethinkDB\">two</a> tutorials (my guide will not cover installation or setup).</p>\n<h2 id=\"preparing-mongodb-exports\">Preparing MongoDB exports</h2>\n<pre><code class=\"language-sh\"># Command\nmongoexport --port PORT_NUMBER --db DATABASE_NAME --collection COLLECTION_NAME --out COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json --pretty --jsonArray \n\n# Example\nmongoexport --port 98765 --db dawebb --collection users --out users-`date &quot;+%Y-%m-%d&quot;`.json --pretty --jsonArray</code></pre>\n<p>There&#39;s a bit to unpack here so I&#39;ll break it down. Keep in mind that all the parameters yelling at you are <em>placeholders</em> (for you to replace with your own parameters).</p>\n<p>Actually, the placeholders are self-explanatory but the second half of the command is interesting.</p>\n<p><code>COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json</code> makes it so the exported collection looks like <code>users-2020-01-24.json</code>, with the date being whenever you ran the above command. Super nifty for backups too.</p>\n<p>The <code>--pretty</code> flag isn&#39;t necessary for the import into RethinkDB to work, it&#39;s for <strong>you</strong> to inspect the export for any reason.</p>\n<p><a href=\"https://docs.mongodb.com/manual/reference/program/mongoexport/#cmdoption-mongoexport-jsonarray\" title=\"MongoDB reference about the &#39;jsonArray&#39; flag\">The last flag</a>, <code>--jsonArray</code>, is the most important. For <em>some reason</em>, MongoDB exports each item in a collection as its own object <strong>not</strong> separated by commas. Maybe MongoDB&#39;s import process doesn&#39;t choke on malformed JSON but everything else does. <code>--jsonArray</code> puts the contents of the export into a single JSON array. Like you&#39;d expect by default...maybe that&#39;s just me.</p>\n<p>NOTE: <code>--out</code> is the destination path so if you haven&#39;t prefaced <code>COLLECTION_NAME-`date &quot;+%Y-%m-%d&quot;`.json</code> with a path, the export will be in your home directory.</p>\n<p>Anyhoo once you&#39;ve exported the collections you care about, SFTP into that server to grab them and place them on your Desktop so you don&#39;t have a brain fart and forget where you put them moments later.</p>\n<h2 id=\"migrating-phase-01\">Migrating, phase 01</h2>\n<p>MongoDB comes with some oddities that you may not want in your new database. Notably, how it deals with IDs. Here&#39;s an example:</p>\n<pre><code class=\"language-json\">{\n &quot;_id&quot;: {\n &quot;$oid&quot;: &quot;6bf9b676c24869077c37f61e&quot;\n },\n &quot;admin&quot;: true,\n &quot;dashboard&quot;: [],\n &quot;language&quot;: &quot;en_US&quot;,\n &quot;loginMethod&quot;: &quot;link&quot;,\n &quot;nameFirst&quot;: &quot;&quot;,\n &quot;nameLast&quot;: &quot;&quot;,\n &quot;plan&quot;: &quot;free&quot;,\n &quot;summaries&quot;: [],\n &quot;timezone&quot;: &quot;gmt-05-02&quot;,\n &quot;verified&quot;: true,\n &quot;email&quot;: &quot;user@domain.tld&quot;,\n &quot;__v&quot;: 0\n}</code></pre>\n<p>In RethinkDB IDs are simply <code>id</code> and you have no need for <code>__v</code> so you probably don&#39;t want these values in your shiny new database. Also, you may have decided to use this migration period switch up your schema. Combine <code>nameFirst</code> with <code>nameLast</code>? Drop <code>plan</code>? Update <code>timzeone</code>? Replace <code>createdAt</code> with <code>created</code>? Regardless, you&#39;re gonna need to do a bit of legwork to clean your MongoDB export(s).</p>\n<p>The entire script I use is hosted <a href=\"https://gist.github.com/NetOperatorWibby/5084bf5c64306093e067fc43cfa4fcdb\" title=\"MongoDB to RethinkDB migration script\">here</a> but I&#39;ll point out some relevant pieces.</p>\n<p>If you have any fields with dates/milliseconds, your import will fail unless you wrap those fields in <code>new Date</code> like so:</p>\n<pre><code class=\"language-json\">…,\ntimestamp: new Date(timestamp),\n…,</code></pre>\n<p>To reuse the IDs that were generated in MongoDB for usage in RethinkDB, you&#39;re gonna need to do something like this:</p>\n<pre><code class=\"language-json\">…,\nid: record._id[&quot;$oid&quot;],\n…,</code></pre>\n<p>You&#39;ll also need to make sure to explicity select the fields you want to transfer into your new export. The gist linked above should answer remaining questions you may have.</p>\n<h2 id=\"importing-into-rethinkdb\">Importing into RethinkDB</h2>\n<p>Even though you&#39;ve already installed RethinkDB, you need to install <a href=\"https://rethinkdb.com/docs/install-drivers/python\" title=\"RethinkDB Python driver installation instructions\">the Python driver</a> as well (for importing functionality, at least I had to do this for macOS).</p>\n<p>Also, make sure you are importing your newly processed/migrated data into RethinkDB, not the original nonsense from your MongoDB export (unless of course, that&#39;s your plan).</p>\n<pre><code class=\"language-sh\"># Command\nrethinkdb import -f PATH_TO_PROCESSED_EXPORT_FILE --table DATABASE.TABLE -c CONNECTION_URL --password-file PASSWORD_FILE --force\n\n# Example\nrethinkdb import -f ~/Desktop/migrated/users-2020-01-24.json --table dawebb.users -c localhost:98765 --password-file ~/Desktop/rethinkpass.txt --force </code></pre>\n<p>If you don&#39;t have a password on your RethinkDB database, you can safely omit the <code>--password-file</code> flag. Otherwise, make sure the password file only contains the password. If your IDE automatically generates new lines in files, just create the password file with <code>nano</code>.</p>\n<p>Make sure you run the above command while RethinkDB is running and you&#39;ll see freshly created tables successfully created.</p>\n<h2 id=\"migrating-phase-02\">Migrating, phase 02</h2>\n<p>Alright, we&#39;re almost at the finish line!</p>\n<p>One of the neat things about RethinkDB (and a feature that convinced me to make the jump) is its Data Explorer. It&#39;s a UI that allows you to manipulate or check out your tables. There are just two remaining things we need to do and they&#39;re quick and easy: 1) set up indexes for our tables and 2) update time-based data to a format RethinkDB <em>really</em> likes.</p>\n<p>Visit <code>http://localhost:8080</code> (default port, unless you changed it) and click on &quot;Data Explorer&quot; in the header. In the text field you&#39;ll be able to perform queries using JavaScript.</p>\n<h3 id=\"setting-up-indexes\">Setting up indexes</h3>\n<p>By default <code>id</code> is an index but you may want more. Indexes are for fields with unique values so it&#39;s easy to think of which field(s) would be suitable.</p>\n<p>Sometimes, only the ID would be unique and that&#39;s fine.</p>\n<pre><code class=\"language-js\">// Command\nr.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).index_create(&quot;FIELD_WITH_UNIQUE_VALUE&quot;); \n\n// Examples\nr.db(&quot;dawebb&quot;).table(&quot;users&quot;).index_create(&quot;email&quot;);\nr.db(&quot;dawebb&quot;).table(&quot;posts&quot;).index_create(&quot;slug&quot;);</code></pre>\n<p>Now let&#39;s update our time-based fields:</p>\n<pre><code class=\"language-js\">// Command\nr.db(&quot;DATABASE_NAME&quot;).table(&quot;TABLE_NAME&quot;).update({\n created: r.ISO8601(r.row(&quot;created&quot;)),\n updated: r.ISO8601(r.row(&quot;updated&quot;))\n});\n\n// Examples\nr.db(&quot;dawebb&quot;).table(&quot;users&quot;).update({\n created: r.ISO8601(r.row(&quot;created&quot;)),\n updated: r.ISO8601(r.row(&quot;updated&quot;))\n});\n\nr.db(&quot;dawebb&quot;).table(&quot;visits&quot;).update({\n timestamp: r.ISO8601(r.row(&quot;timestamp&quot;))\n});</code></pre>\n<h2 id=\"fin\">FIN</h2>\n<p>And there you have it! A super easy guide to move from MongoDB to RethinkDB. I&#39;ve been using RethinkDB for several months now and I am way happier than I was with MongoDB. While super easy to get into, once you get in too deep it becomes an exercise in frustration to find solutions to ambiguous errors and the MongoDB docs are not user-friendly.</p>\n<p>Contrast that with RethinkDB&#39;s Data Explorer, clear error messages, and clean documentation and it&#39;s not difficult to imagine why I&#39;d make the switch. 🕸</p>\n<p>P.S. New year, <a href=\"https://socii.network/NetOpWibby/status/e3HWCaoqTZYzZvZ47RXfp\" title=\"Sneak peek at codebase\">new projects</a>, and now I feel like I need a new design for this blog. And then I remembered that first I need to create a <a href=\"/2019/a-personal-api\" title=\"A Personal API\">personal API</a> so this blog can just become the presentation layer for the content.</p>\n<p><strong><em>2020.01.30 update</em></strong></p>\n<blockquote>\n<p>Another reason to migrate is the license of MongoDB: SSPL vs. Apache 2 of RethinkDB.<br/>— <a href=\"https://lobste.rs/u/af\">af</a></p>\n</blockquote>\n<p>For others who may not know what <a href=\"https://lukasatkinson.de/2019/mongodb-no-longer-seeks-osi-approval-for-sspl\">SSPL</a> entails (like me until I read the linked post):</p>\n<p>Basically, SSPL means one cannot offer MongoDB as a hosted service. That makes sense from their end as they offer hosting. However, it&#39;s a bit of a punk move because they are preventing potential competition from forcing them to improve their product.</p>\n",
29 "url": "https://blog.webb.page/2020/migrating-from-mongo-to-rethink",
29 "url": "https://blog.webb.page/2020/migrating-from-mongo-to-rethink",
30 "title": "Migrating from MongoDB to RethinkDB",
30 "title": "Migrating from MongoDB to RethinkDB",
31 "summary": "Thank me later",
31 "summary": "Thank me later",
@@ -133,19 +133,18 Now let's update our time-based fields:
133 ```js
133 ```js
134 // Command
134 // Command
135 r.db("DATABASE_NAME").table("TABLE_NAME").update({
135 r.db("DATABASE_NAME").table("TABLE_NAME").update({
136 created: r.iso8601(r.row["created"]).to_iso8601(),
136 created: r.ISO8601(r.row("created")),
137 updated: r.iso8601(r.row["updated"]).to_iso8601()
137 updated: r.ISO8601(r.row("updated"))
138 });
138 });
139
139
140 // Examples
140 // Examples
141 r.db("dawebb").table("users").update({
141 r.db("dawebb").table("users").update({
142 created: r.iso8601(r.row["created"]).to_iso8601(),
142 created: r.ISO8601(r.row("created")),
143 updated: r.iso8601(r.row["updated"]).to_iso8601()
143 updated: r.ISO8601(r.row("updated"))
144 });
144 });
145
145
146 r.db("dawebb").table("visits").update({
146 r.db("dawebb").table("visits").update({
147 created: r.iso8601(r.row["created"]).to_iso8601(),
147 timestamp: r.ISO8601(r.row("timestamp"))
148 timestamp: r.iso8601(r.row["timestamp"]).to_iso8601()
149 });
148 });
150 ```
149 ```
151
150
@@ -14,17 +14,17
14 },
14 },
15 "dependencies": {
15 "dependencies": {
16 "chewit": "^2019.7.23",
16 "chewit": "^2019.7.23",
17 "fastify": "2.12.0",
17 "fastify": "2.13.0",
18 "fastify-compress": "^2.0.1",
18 "fastify-compress": "^2.0.1",
19 "fastify-helmet": "^3.0.2",
19 "fastify-helmet": "^3.0.2",
20 "fastify-static": "^2.6.0",
20 "fastify-static": "^2.6.0",
21 "feed": "^4.1.0",
21 "feed": "^4.1.0",
22 "marked": "^0.8.0"
22 "marked": "^0.8.2"
23 },
23 },
24 "description": "Blog of Paul Anthony Webb",
24 "description": "Blog of Paul Anthony Webb",
25 "devDependencies": {
25 "devDependencies": {
26 "@babel/cli": "^7.8.4",
26 "@babel/cli": "^7.8.4",
27 "@babel/core": "^7.8.4",
27 "@babel/core": "^7.9.0",
28 "@babel/plugin-external-helpers": "7.8.3",
28 "@babel/plugin-external-helpers": "7.8.3",
29 "@babel/plugin-proposal-class-properties": "7.8.3",
29 "@babel/plugin-proposal-class-properties": "7.8.3",
30 "@babel/plugin-proposal-decorators": "7.8.3",
30 "@babel/plugin-proposal-decorators": "7.8.3",
@@ -35,33 +35,33
35 "@babel/plugin-proposal-throw-expressions": "7.8.3",
35 "@babel/plugin-proposal-throw-expressions": "7.8.3",
36 "@babel/plugin-syntax-dynamic-import": "7.8.3",
36 "@babel/plugin-syntax-dynamic-import": "7.8.3",
37 "@babel/plugin-syntax-import-meta": "7.8.3",
37 "@babel/plugin-syntax-import-meta": "7.8.3",
38 "@babel/polyfill": "^7.8.3",
38 "@babel/polyfill": "^7.8.7",
39 "@babel/preset-env": "^7.8.4",
39 "@babel/preset-env": "^7.9.5",
40 "@babel/register": "^7.8.3",
40 "@babel/register": "^7.9.0",
41 "@inc/eslint-config": "^2019.10.22",
41 "@inc/eslint-config": "^2019.10.22",
42 "@inc/stylelint-config": "^2019.12.1",
42 "@inc/stylelint-config": "^2019.12.1",
43 "alphabetic-compare": "^1.1.4",
43 "alphabetic-compare": "^1.1.4",
44 "chronver": "^2020.2.24",
44 "chronver": "^2020.3.9",
45 "colorette": "^1.1.0",
45 "colorette": "^1.1.0",
46 "cwd": "^0.10.0",
46 "cwd": "^0.10.0",
47 "eslint": "^6.8.0",
47 "eslint": "^6.8.0",
48 "glob": "^7.1.6",
48 "glob": "^7.1.6",
49 "graceful-fs": "^4.2.3",
49 "graceful-fs": "^4.2.3",
50 "html-minifier": "^4.0.0",
50 "html-minifier": "^4.0.0",
51 "husky": "^4.2.3",
51 "husky": "^4.2.4",
52 "js-yaml": "^3.13.1",
52 "js-yaml": "^3.13.1",
53 "link-module-alias": "^1.2.0",
53 "link-module-alias": "^1.2.0",
54 "nodemon": "^2.0.2",
54 "nodemon": "^2.0.3",
55 "npm-run-all": "^4.1.5",
55 "npm-run-all": "^4.1.5",
56 "pino-pretty": "^3.6.0",
56 "pino-pretty": "^4.0.0",
57 "recursive-readdir": "^2.2.2",
57 "recursive-readdir": "^2.2.2",
58 "sass": "^1.26.1",
58 "sass": "^1.26.3",
59 "snazzy": "^8.0.0",
59 "snazzy": "^8.0.0",
60 "standardx": "^5.0.0",
60 "standardx": "^5.0.0",
61 "stylelint": "^13.2.0",
61 "stylelint": "^13.3.1",
62 "stylelint-order": "^4.0.0",
62 "stylelint-order": "^4.0.0",
63 "tiny-relative-date": "^1.3.0",
63 "tiny-relative-date": "^1.3.0",
64 "updates": "^9.3.3",
64 "updates": "^10.2.7",
65 "viperhtml": "^2.17.1"
65 "viperhtml": "^2.17.1"
66 },
66 },
67 "engines": {
67 "engines": {
@@ -98,5 +98,5
98 "app/dist"
98 "app/dist"
99 ]
99 ]
100 },
100 },
101 "version": "2020.02.27"
101 "version": "2020.04.09"
102 }
102 }
Comments 0
You need to be logged in to leave comments. Login now