<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Peter Lau</title>
    <description>The latest articles on DEV Community by Peter Lau (@peterlau).</description>
    <link>https://dev.to/peterlau</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F394840%2F946c5dcd-839a-4927-9a88-19bbeba489be.jpg</url>
      <title>DEV Community: Peter Lau</title>
      <link>https://dev.to/peterlau</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/peterlau"/>
    <language>en</language>
    <item>
      <title>MongoDB |&gt; server selection error: server selection timeout Type: ReplicaSetNoPrimary</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Tue, 01 Sep 2020 18:00:07 +0000</pubDate>
      <link>https://dev.to/peterlau/mongodb-server-selection-error-server-selection-timeout-type-replicasetnoprimary-1pin</link>
      <guid>https://dev.to/peterlau/mongodb-server-selection-error-server-selection-timeout-type-replicasetnoprimary-1pin</guid>
      <description>

&lt;p&gt;Get a wired error message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error connecting to host: could not connect to 
server:server selection error: server selection timeout, 
current topology: { Type: ReplicaSetNoPrimary, Servers: 
[{ Addr: admin:27017, Type: Unknown, State: Connected, 
Average RTT: 0, Last error: connection() : dial tcp: 
lookup admin: no such host }, ] }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;when using &lt;code&gt;mongoimport&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Fix that by adding argument &lt;code&gt;--uri&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;mongoimport 
    &lt;span class="nt"&gt;--uri&lt;/span&gt; &lt;span class="s2"&gt;"mongodb://&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;@
&amp;lt;ip or domain&amp;gt;:&amp;lt;port&amp;gt;/?authSource=
&amp;lt;authSource&amp;gt;&amp;amp;authMechanism=SCRAM-SHA-1"&lt;/span&gt; 
    &lt;span class="nt"&gt;-d&lt;/span&gt; &amp;lt;db&amp;gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &amp;lt;collection&amp;gt; 
    &lt;span class="nt"&gt;--file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;./data.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Maybe also works with &lt;code&gt;mongo&lt;/code&gt; and &lt;code&gt;mongoexport&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;References&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/59413297/error-connecting-to-host-could-not-connect-to-server-server-selection-error-s"&gt;https://stackoverflow.com/questions/59413297/error-connecting-to-host-could-not-connect-to-server-server-selection-error-s&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Can markdown of dev.to do this ?</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Sun, 30 Aug 2020 13:44:19 +0000</pubDate>
      <link>https://dev.to/peterlau/discover-dev-to-markdown-syntax-224l</link>
      <guid>https://dev.to/peterlau/discover-dev-to-markdown-syntax-224l</guid>
      <description>&lt;h2&gt;
  
  
  TOC
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
❓ wrap line in code (manually wrap) &lt;a&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
✅ support strikethrough &lt;a&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
✅ support table &lt;a&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
✅ support emoji &lt;a&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ❓ &lt;a&gt;wrap line in code (manually wrap)&lt;/a&gt;  🔙
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error connecting to host: could not connect to 
server:server selection error: server selection timeout, 
current topology: { Type: ReplicaSetNoPrimary, Servers: 
[{ Addr: admin:27017, Type: Unknown, State: Connected, 
Average RTT: 0, Last error: connection() : dial tcp: 
lookup admin: no such host }, ] }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  ✅ &lt;a&gt;support strikethrough&lt;/a&gt;  🔙
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight markdown"&gt;&lt;code&gt;~~Strikethrough~~ (❗️ no space between text)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;del&gt;Strikethrough&lt;/del&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ &lt;a&gt;support table&lt;/a&gt;  🔙
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight markdown"&gt;&lt;code&gt;First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;First Header&lt;/th&gt;
&lt;th&gt;Second Header&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Content from cell 1&lt;/td&gt;
&lt;td&gt;Content from cell 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Content in the first column&lt;/td&gt;
&lt;td&gt;Content in the second column&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  ✅ &lt;a&gt;support emoji&lt;/a&gt;  🔙
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;:warning:&lt;/code&gt;&lt;br&gt;
⚠️&lt;br&gt;
&lt;strong&gt;THAKS &lt;a href="https://dev.to/titanhero/comment/14917"&gt;reply&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>markdown</category>
      <category>syntax</category>
      <category>dev</category>
    </item>
    <item>
      <title>CLI |&gt; Compress and Decompress via CLI</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Fri, 28 Aug 2020 04:09:18 +0000</pubDate>
      <link>https://dev.to/peterlau/cli-compress-and-decompress-via-cli-l1b</link>
      <guid>https://dev.to/peterlau/cli-compress-and-decompress-via-cli-l1b</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;IF YOU JUST SOLVED SOME PROBLEM, WELCOME TO DM &lt;strong&gt;qaRabbit&lt;/strong&gt; ON &lt;a href="https://twitter.com/qaRabbitx"&gt;TWITTER&lt;/a&gt;, OR CREATE A PULL REQUEST IN &lt;a href="https://github.com/supeterlau/quickanswer"&gt;GITHUB REPO&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  macOS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;file.zip&lt;/p&gt;

&lt;p&gt;extract to the current directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;unzip file.zip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract to the target directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;unzip file.zip -d target_dir_path&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;compress to file.zip&lt;/p&gt;

&lt;p&gt;&lt;code&gt;zip file path1 path2 path3&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;file.tar (archive, no compress)&lt;/p&gt;

&lt;p&gt;extract to the current directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xvf file.tar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract to target_dir_path (must be created first)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir -p target_dir_path &amp;amp;&amp;amp; tar -C target_dir_path -xvf file.tar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;compress path&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -cvf file.tar path1 path2&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;file.tar.gz file.tgz&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;tar.gz&lt;/strong&gt; file is a &lt;strong&gt;Tar archive&lt;/strong&gt; compressed with &lt;strong&gt;Gzip&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;extract to the current directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -zxvf file.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract to target_dir_path (must be created first)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir -p target_dir_path &amp;amp;&amp;amp; tar -C target_dir_path -zxvf file.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;compress path&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -czvf file.tar.gz path1 path2 ...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;compress with exclude&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -czvf file.tar.gz path --exclude=sub_path1 --exclude=sub_path2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -czvf file.tar.gz path --exclude={sub_path1, sub_path2}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -czvf file.tar.gz path --exclude=*.ext&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;file.tar.xz&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;tar.gz&lt;/strong&gt; file is a &lt;strong&gt;Tar archive&lt;/strong&gt; compressed with &lt;strong&gt;Xz&lt;/strong&gt; a LZMA based compress algorithm&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;tar auto-detects compression type and extracts the archive&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xf file.tar.xz&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;file.tar.bz2 file.tbz&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;tar.bz2&lt;/strong&gt; file is a &lt;strong&gt;Tar archive&lt;/strong&gt; compressed with &lt;strong&gt;Bzip2&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;extract to the current directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xvf file.tar.bz2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract to target_dir_path (--directory, -C; must be created first)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir -p target_dir_path &amp;amp;&amp;amp; tar -xvf file.tar.bz2 -C target_dir_path&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract specific files&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xf archive.tar.bz2 file1 file2 dir1 dir2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -xf archive.tar.bz2 --wildcards '*.md'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;extract from stdin&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wget -c ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2 -O - | sudo tar -xj&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;list archive content (--list, -t)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -tvf file.tar.bz2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;compress path&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tar -cjvf file.tar.bz2 path1 path2&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  GNU/Linux
&lt;/h2&gt;




&lt;p&gt;&lt;em&gt;References&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.cyberciti.biz/faq/linux-howto-unzip-files-in-root-directory/"&gt;https://www.cyberciti.biz/faq/linux-howto-unzip-files-in-root-directory/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hostingmanual.net/zipping-unzipping-files-unix/"&gt;https://www.hostingmanual.net/zipping-unzipping-files-unix/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://linuxize.com/post/how-to-create-and-extract-archives-using-the-tar-command-in-linux/"&gt;https://linuxize.com/post/how-to-create-and-extract-archives-using-the-tar-command-in-linux/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://linuxize.com/post/how-to-extract-unzip-tar-bz2-file"&gt;https://linuxize.com/post/how-to-extract-unzip-tar-bz2-file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pendrivelinux.com/how-to-open-a-tar-file-in-unix-or-linux/"&gt;https://www.pendrivelinux.com/how-to-open-a-tar-file-in-unix-or-linux/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/"&gt;https://www.howtogeek.com/248780/how-to-compress-and-extract-files-using-the-tar-command-on-linux/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://unix.stackexchange.com/questions/25311/create-target-directory-when-extracting-tarball"&gt;https://unix.stackexchange.com/questions/25311/create-target-directory-when-extracting-tarball&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>quickanswer</category>
      <category>cli</category>
      <category>tar</category>
      <category>zip</category>
    </item>
    <item>
      <title>Build X from source is so hard 😭</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Thu, 27 Aug 2020 18:02:31 +0000</pubDate>
      <link>https://dev.to/peterlau/build-x-from-source-is-so-hard-561b</link>
      <guid>https://dev.to/peterlau/build-x-from-source-is-so-hard-561b</guid>
      <description>&lt;p&gt;Default Version: latest&lt;/p&gt;

&lt;h2&gt;
  
  
  On Ubuntu 18.04:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;servo ❌ 
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/servo"&gt;
        servo
      &lt;/a&gt; / &lt;a href="https://github.com/servo/servo"&gt;
        servo
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      The Servo Browser Engine
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;lumen ❌ 
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lumen"&gt;
        lumen
      &lt;/a&gt; / &lt;a href="https://github.com/lumen/lumen"&gt;
        lumen
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      An alternative BEAM implementation, designed for WebAssembly
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;tensorbase ❌ 
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/tensorbase"&gt;
        tensorbase
      &lt;/a&gt; / &lt;a href="https://github.com/tensorbase/tensorbase"&gt;
        tensorbase
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      TensorBase is building a modern big data warehouse with performance in its core mind.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  On macOS Catalina (Version 10.15.5)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Emacs27 ✅
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/d12frosted"&gt;
        d12frosted
      &lt;/a&gt; / &lt;a href="https://github.com/d12frosted/homebrew-emacs-plus"&gt;
        homebrew-emacs-plus
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Emacs Plus formulae for the Homebrew package manager
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>build</category>
      <category>compile</category>
      <category>sourcecode</category>
    </item>
    <item>
      <title>MongoDB |&gt; How to Select a Single Field for All Documents in a MongoDB Collection</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Thu, 27 Aug 2020 17:56:29 +0000</pubDate>
      <link>https://dev.to/peterlau/mongodb-how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection-o39</link>
      <guid>https://dev.to/peterlau/mongodb-how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection-o39</guid>
      <description>&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;food&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In above example from the folks at Mongo, the returned documents will contain only the fields of item, qty, and _id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;food&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In above example from the folks at Mongo, the returned documents will contain only the fields of item, and _id.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;References&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection"&gt;https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection"&gt;https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>quickanswer</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>Hugo |&gt; Dev Server Open Browser</title>
      <dc:creator>Peter Lau</dc:creator>
      <pubDate>Thu, 27 Aug 2020 16:26:59 +0000</pubDate>
      <link>https://dev.to/peterlau/hugo-dev-server-open-browser-4512</link>
      <guid>https://dev.to/peterlau/hugo-dev-server-open-browser-4512</guid>
      <description>

&lt;blockquote&gt;
&lt;p&gt;IF YOU JUST SOLVED SOME PROBLEM, WELCOME TO DM &lt;strong&gt;qaRabbit&lt;/strong&gt; ON &lt;a href="https://twitter.com/qaRabbitx"&gt;TWITTER&lt;/a&gt;, OR CREATE A PULL REQUEST IN &lt;a href="https://github.com/supeterlau/quickanswer"&gt;GITHUB REPO&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why hugo dev server can't open browser tab automatically?&lt;/p&gt;

&lt;p&gt;Modify hugo source code will definitely solve this issue.&lt;/p&gt;

&lt;p&gt;Or we can use two simpler ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;use some program to run command &lt;code&gt;hugo server&lt;/code&gt; and &lt;code&gt;open_browser&lt;/code&gt; &lt;a href="https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/"&gt;in parallel&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;use simple command sleep&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the second way on &lt;strong&gt;macOS&lt;/strong&gt;: (open command only works on macOS)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;LOCAL_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:1313

open_browser &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;duration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;3&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;
  &lt;span class="nb"&gt;sleep&lt;/span&gt; &lt;span class="nv"&gt;$duration&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'After '&lt;/span&gt;&lt;span class="nv"&gt;$duration&lt;/span&gt;
  &lt;span class="c"&gt;# change open command to proper one&lt;/span&gt;
  open &lt;span class="nt"&gt;--new&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; &lt;span class="s2"&gt;"Google Chrome"&lt;/span&gt; &lt;span class="nt"&gt;--args&lt;/span&gt; &lt;span class="nv"&gt;$LOCAL_URL&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

open_browser 1 &amp;amp;
hugo server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;






&lt;p&gt;&lt;em&gt;Reference&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/gohugoio/hugo/issues/6293"&gt;https://github.com/gohugoio/hugo/issues/6293&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/"&gt;https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://zwbetz.com/open-a-new-google-chrome-tab-or-window-via-command-line-on-mac"&gt;https://zwbetz.com/open-a-new-google-chrome-tab-or-window-via-command-line-on-mac&lt;/a&gt;"&lt;/p&gt;

</description>
      <category>quickanswer</category>
      <category>macos</category>
      <category>hugo</category>
      <category>chrome</category>
    </item>
  </channel>
</rss>
