<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Caspar Chang on Medium]]></title>
        <description><![CDATA[Stories by Caspar Chang on Medium]]></description>
        <link>https://medium.com/@askstw?source=rss-e81be14566dc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-GNZ923ENHW8MyXc</url>
            <title>Stories by Caspar Chang on Medium</title>
            <link>https://medium.com/@askstw?source=rss-e81be14566dc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 15:49:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@askstw/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[在MongoDB尋求資料正規化是否搞錯了什麼？]]></title>
            <link>https://askstw.medium.com/mongodb-data-model-design-2cfe70024c88?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cfe70024c88</guid>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mongodb-data-model]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Sat, 03 Jul 2021 10:59:28 GMT</pubDate>
            <atom:updated>2021-07-03T12:09:56.348Z</atom:updated>
            <content:encoded><![CDATA[<h3>MongoDB資料模型設計指南</h3><p>今天想要跟大家分享一下 MongoDB 的 資料模型設計的基礎概念，幫助大家在使用上可以更簡單，更有效率。</p><blockquote>MongoDB是Json Document Sotre的資料庫，屬於Flexible Data Model, 可以有著更好的效率進行資料的讀寫，同時讓使用者可以更彈性的制定專屬於應用的資料模型，可以不需要再一昧的要求正規化，能夠調整到最適合開發者的效益(簡易方便/效能最佳)。</blockquote><h3><strong>如何設計MongoDB的資料模型？</strong></h3><p>首先你必須要了解一件事情，MongoDB可以實現多樣化的資料模型，例如 Key/Value，Sub Documents 等方式，所以資料模型在MongoDB裡面沒有標準答案。</p><p>永遠沒有最好的資料模型，只有最適合你的應用的資料模型。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*iiT-SzUWY8U08SN9xcTuJg.png" /></figure><h4>Flexible Schema = No Schema ?</h4><p>但是對於初入MongoDB的使用者來說，往往由於感覺資料模型太過於<strong>”彈性”</strong>而無所適從，不知道該如何下手，常常會問怎麼樣的資料模型才是最好的？</p><p>事實上沒有想像中的那麼複雜，大多情況就是依照開發者的<strong>“直覺”</strong>，再加上一些的美味秘方做調整就可以了，所以我也特別整理了一些自己在Model Design上的經驗與大家分享。</p><h4><strong>文檔資料模型特色</strong></h4><p>首先必須要說關聯式資料庫的正規化是有<strong>“優點”</strong>的，讓你在開發應用的時候就像在<strong>“抄作業”</strong>，雖然實行資料關聯相對繁瑣複雜，但如果熟悉後其實也不難，反正就是在套公式。</p><p>但同時關聯式資料庫的正規化，在微服務興起，需求快速改變的時代，缺點也比較明顯，那就是面對需求改變的時候，明顯應變不足。</p><p>以一個部落格為例子，若今天需求改變，使用者的興趣想要能夠儲存多個，則架構需要調整，興趣欄位必需單獨拉出來做資料正規化，需要透過Join來取得所有資料，程式碼需要調整，資料庫結構(DDL)需要改變。</p><p>而程式碼的改動與DDL的改動，在開發環境、測試環境、正式環境，一層一層跟著異動，時常會花費大量的時間做反覆的確認以免發生程式碼改了，DDL沒有跟著改的狀況，或是程式還沒上版DDL就先異動。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*NEoy-viB3Uaw7hklBwDzow.png" /></figure><p>而如果使用文檔資料模型，少去了改動DDL的步驟，則可以輕鬆的面對改變帶來的挑戰。</p><p>當需求改變，只需要調整少數程式碼，把interest物件從單一值改為矩陣，然後隨著程式的上版，異動就完成了，實際上是真的非常簡單方便。</p><blockquote>文檔資料模型無需再維護資料庫結構(DDL)，提升開發效率。</blockquote><blockquote>也無需使用Join來取得關聯資料，不會有潛在的效能問題。</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*61yQFpt2AAm23fKhGarUQQ.png" /></figure><h4>模型設計方法比較</h4><p>所以從一般的RDB與MongoDB的模型設計理念比較來看，可以看到MongoDB的優勢在於<strong>“從服務應用開始著手，並且有著容易更改的特性”</strong></p><p>所以文檔資料模型的設計方法會從應用行為定義開始，透過行為來決定資料關聯，與關聯式資料庫的理念剛好相反，更能夠從應用開發的角度出發。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*xqBPNrrAcGQHQaxIJlFfgw.png" /></figure><h4><strong>資料關聯方式說明</strong></h4><p>提到了資料關聯，我想大家對於一般的RDB做Foreign Key，做Join應該都不陌生，而MongoDB如何做資料關聯呢？</p><p>MongoDB 現行主要使用兩種方式做資料關聯，分別為 <strong>Embedding</strong> 與 <strong>Referencing</strong>。</p><pre><strong>•Embedding</strong><br>將關聯資料以子文檔(Subdocuments)的方式存在同一個資料表裡面，方便直接取用。<br>    例如：Category, Comment, Tag</pre><pre><strong>•Referencing<br></strong>將關聯資料獨立出來成一個文檔，適合分別存取使用，需要時可以透過MongoDB的Join功能 ($lookup) 來做關聯查詢。<br>    例如：User</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*LxVsHfR2R_KhSKzJr1V-5Q.png" /></figure><p>所以MongoDB在資料關聯的應用上是彈性的，而 Embedding 與 Referencing 的選擇，可依照使用行為的不同來決定，以下是關聯的使用優點與注意事項，至於有沒有懶人包呢？ 有的。</p><p>那就是<strong>『盡量使用Embedding除非有效能問題』。</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*ZBOvvHwCWAMiEMJtbm0YLA.png" /></figure><h3><strong>開始設計資料模型</strong></h3><p>在開始設計MongoDB的資料模型前，你必須要有已經定義好的資料實體與使用行為，以及最好有操作的頻率以及期望的效能來決定設計的走向。</p><p>例如今天我們想要設計電商購物車平台：</p><p>需要有哪些資料實體，例如：產品目錄，庫存，訂單，客戶，金流。</p><p>需要有哪些行為，例如：商品總覽，商品明細，庫存資訊，訂單資訊，會員管理。</p><p>整理並統計這些行為的頻率/併發數以及期望的回應時間與優先的程度 。</p><h4>資料模型設計步驟</h4><p>當相關的資料都準備好之後，接下來就是正式的 Data Model Design 的環節了，事實上只需要三個步驟，而初見MongoDB的開發者可以從左邊最簡單的的設計方法開始，就可以打造一個符合MongoDB建議的模型設計。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*WUXBkq2N2tLg3PUwRAQLKg.png" /></figure><h4>設計初始資料模型</h4><p>例如一開始提到的部落格，主要的行為就是寫文章，則模型的設計主體就會以文章為出發點做設計，所以所有的資料關聯則就會被以Embeding的方式被納入文章主體中作一起存取。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*r0XSr5o8YLvV15DIM6T7aA.png" /></figure><h4>資料模型調整</h4><p>而當模型依照主要的使用方式設計完成後，接下來就是審視其他的使用方式與需求，來確認資料模型是否需要再調整。</p><p>在此部落格，我們除了文章主體以外，還有會員資料是需要單獨管理的，所以我們可以思考評估是否要把會員給單獨拆分出來，而最後的模型就會是我們依照需求所定義出來的。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*vshsjDb_cjG-Bv6ZVQR7Rw.png" /></figure><h4><strong>套用模型最佳化指南</strong></h4><p>最後在設計完成後，如果還有餘力可以再參考 <strong>Design Pattern </strong>與<strong> Design Anti-Pattern </strong>來思考是否有進一步優化的空間。</p><p>但這不是必要的步驟，也不常進行，通常在發生效能問題的時候才會去思考如何改善。</p><p>關於這兩種 <strong>Pattern </strong>，由於篇幅的關係我會留到下次再跟各位做分享。</p><h4><strong>重點回顧</strong></h4><p><strong>最後我們再來回顧一下今天分享的重點：</strong></p><blockquote><strong>1.在大多數情況下，資料關聯建議使用Embeding。</strong></blockquote><blockquote><strong>2.除非資料有單獨存取的需求，再使用Referencing。</strong></blockquote><blockquote><strong>3.關聯資料存取盡量避免使用Join ($lookup)，可以使用兩次查詢取代。</strong></blockquote><blockquote><strong>4.如果有使用Array，盡量避免儲存超過一百個。</strong></blockquote><blockquote><strong>5.視情況參考進階的Design Pattern或是Anti-Pattern</strong></blockquote><h4><strong>參考資源</strong></h4><p>對於MongoDB Model Design, 如果還有興趣了解更多，可以參考以下文章。</p><pre><strong>Data Modeling - MongoDB University</strong></pre><pre>    https://university.mongodb.com/courses/M320/about</pre><pre><strong>MongoDB Blog - Design Best Practice</strong></pre><pre>    https://developer.mongodb.com/article/mongodb-schema-design-best-practices/</pre><pre><strong>MongoDB Blog - Design Patterns</strong></pre><pre>    https://www.mongodb.com/blog/post/building-with-patterns-a-summary</pre><pre><strong>MongoDB Blog - Design Anti-Patterns</strong></pre><pre>    https://developer.mongodb.com/article/schema-design-anti-pattern-summary/</pre><pre><strong>MongoDB Manual - Data Model</strong></pre><pre>    https://docs.mongodb.com/manual/core/data-model-design/</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cfe70024c88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[關於我轉生變成 (Atlas) 使用者這檔事]]></title>
            <link>https://askstw.medium.com/mongodb-atlas-9a286dea1945?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a286dea1945</guid>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Fri, 04 Jun 2021 08:42:09 GMT</pubDate>
            <atom:updated>2021-06-04T08:42:09.902Z</atom:updated>
            <content:encoded><![CDATA[<p>隨著雲端的普及，Atlas 的使用者也開始逐漸變多，所以今天特地整理Atlas上常用功能與常見問題，讓大家在可以在使用的時候，更明確的知道如何去做使用與設定。</p><blockquote>本文是Atlas的進階分享心得文，如果還沒有接觸過Atlas的使用者，可以先參考基礎篇：<a href="https://askstw.medium.com/re-mongodb-atlas-b331acd3d7c">Re:從零開始的MongoDB Atlas生活</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*zASRYTPKy44OW3RWxW3i0g.png" /></figure><h3>1.集群部署規劃</h3><h4>1–1. 選擇喜歡的雲與區域</h4><p>Atlas能夠在全球AWS, GCP, AZURE中80多個區域中使用，首先要想好哪個雲哪個區域來部署MongoDB主集群。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*n7PqiF4gIytTqBA5Xb6J-A.png" /></figure><p>同時由於Atlas上面的MongoDB集群，都是預設使用ReplicaSet 三個節點的架構，所以當有需要的時候可以把下方的Multi-Cloud, Multi-Region 打開，進而來使用跨區/跨雲的服務。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*kVhpLbwRY74ZSKucf71HUA.png" /></figure><h4>1-2. 決定集群的大小</h4><p>集群的大小可以自由選擇，一般正式環境我會建議從M30開始，M30開始都是 dedicated 的機器，不會有吵鬧的鄰居(noisy neighbour)影響。</p><p>至於要怎麼選一個適合的大小呢？ 依我個人的經驗，我會有以下的一些數字做初始建議：</p><pre>CPU : 每顆CPU保守估計可提供每秒200~400以上的操作數。<br>        操作為一般的CRUD，也就是Insert/Update/Delete/Find/Aggregate</pre><pre>IOPS : 建議為操作數*2，也就是CPU數乘800，以避免IO變成瓶頸。<br>    (IOPS與磁碟空間正相關，可放大磁碟空間來增加IOPS)。</pre><pre>Disk : 原始資料量的40%，MongoDB內建資料壓縮的功能，壓縮比約3倍。</pre><pre>Memory : 原始資料量的5%~10%，越多越好。 <br>    (視熱存取資料量，熱資料越多記憶體需求越大)</pre><p>另外針對資料量大運算少的應用服務，可以考慮使用Low Cpu的規格來節省開銷。</p><h4>1-3. 透過API實現自動化</h4><p>Atlas 內建的 <a href="https://docs.atlas.mongodb.com/api/">API</a> 服務能夠輕易實現 Infra Sturctre as a Code, 亦可以進一步整合 <a href="https://www.mongodb.com/atlas/hashicorp-terraform">TerraForm</a> 做自動化部屬。</p><p>以下是 Atlas API 參考 <a href="https://docs.atlas.mongodb.com/reference/api/root/">Sample Code</a> :</p><pre><strong>識別自己的Org/Project Id :<br>    </strong>通常會在Atlas的url上<br>Atlas Org Id : 5e549ec4063e812ba4be7d34<br>Atlas Project Id : 5f07bcad7874914992f00296</pre><pre><strong>建立API Key：</strong><br>Atlas API Public Key : ipermyhc<br>Atlas API Private Key : 89e83a46-da2e-454c-95f5-b419bbfc16a1</pre><pre><strong>Get All Projects in an Organization :<br></strong>curl --user &quot;&lt;Public Key&gt;:&lt;Private Key&gt;&quot; --digest \ &quot;https://cloud.mongodb.com/api/atlas/v1.0/orgs/&lt;Org Id&gt;/groups?pretty=true&quot;</pre><pre><strong>Get All Clusters in a Project :<br></strong>curl --user &quot;&lt;Public Key&gt;:&lt;Private Key&gt;&quot; --digest \ &quot;https://cloud.mongodb.com/api/atlas/v1.0/groups/&lt;Project Id&gt;/clusters?pretty=true&quot;</pre><h3>2. 集群配置規劃</h3><h4>2-1. 隨需更改配置</h4><p>萬一集群的資源不夠使用了，怎麼辦？</p><p>不用擔心，Atlas的集群調整是完全不停機，應用程式不會中斷，詳情請參閱<a href="https://www.mongodb.com/cloud/atlas/sla">Atlas SLA</a>。</p><p>透過集群調整，可以輕易實現以改變 :</p><pre>垂直擴容 : 可以將M30集群升級成M40集群, 反之亦然。<br>水平擴容 : 可以將M30集群升級至M30分片，反之亦然。<br>部署轉移：不管是區域移轉還是雲端移轉，都可以自由調整。<br>版本升級 : Atlas會永遠保持在該版本的最新Fix, 會自行做Rolling Upgrade.</pre><h4>2–2. 多元的網路配置</h4><p>Atlas 特別提供 <a href="https://developer.mongodb.com/article/srv-connection-strings/">MongoDB SRV</a> 的功能，使用單一連線字串就能夠連到整個集群，再也不用輸入一大亂的連線字串了，同時還內建 load balance 與 連線最近的節點的功能，非常的方便實用。</p><p>此外因應雲端網路的需求，也提供雲端私有網路連接，以<a href="https://docs.atlas.mongodb.com/security-vpc-peering/">Peering</a>為例，只要輸入對應的ID/CIDR就能夠輕鬆地改為私有網路連接。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*u0vsqPsZpDHFn_x3nyK11Q.png" /></figure><h4>2-3. 資料安全說明</h4><p>Atlas 本身提供非常多安全功能來符合企業使用，詳情請參閱<a href="https://www.mongodb.com/cloud/trust">合規說明</a>。</p><p>我也針對常見的資料安全做說明：</p><pre>連線加密 TLS : <br>    Atlas只能透過加密連線方式使用。</pre><pre>資料加密 Encryption at Rest : <br>    Atlas的資料必須做加密, 密鑰預設由 Atlas 保管，也可以使用雲端的密鑰管理服務，例如AWS KMS作統一管理。</pre><pre>資料稽核 Audit : <br>    可以額外開啟資料稽核功能記錄所有的DDL/DML操作。</pre><pre>權限整合 LDAP : <br>    可以與 LDAP 做整合。</pre><h3>3. 集群管理建議</h3><h4>3–1. 持續監控服務</h4><p>MongoDB 本身提供了 mongotop與mongostat 的各式指標，讓我們可以知道資料庫即時的健康狀態。</p><p>而Atlas則持續蒐集這些資訊來做統一呈現，總共有數十種metrics，而我一般在使用的時候會觀察下面幾個參數：</p><pre>CPU : <br>    如果在高峰期超過70% 就建議要有集群升級的打算了，避免效能異常。</pre><pre>IOPS :<br>    需要確保有足夠的IOPS避免效能瓶頸。</pre><pre>Disk Util % : <br>    同IOPS，高峰期盡量低於60%。</pre><pre>Opcounters : <br>    了解現行集群的用量，每秒多少讀與寫。</pre><pre>Query Targeting: <br>    掃描的資料與實際取得資料的比率，越低越好，若使用正確的Index會幾乎 1:1。</pre><pre>Connections :<br>    如果數量暴增，可能有效能問題，需要注意。</pre><pre>Memory : <br>    無需特別關注，因為WildTiger Engine預設就會吃到80%。</pre><p>當然實務上還有很多參數可以觀測與改善，而我一般是用這樣的方式快速評斷集群資源是否足夠使用，作為是否需要擴容的依據。</p><h4>3–2. 效能調校服務</h4><p>Profiler 是 MongoDB 裡面很重要的功能，預設會把執行超過 100ms 的&quot;指令” (大多是查詢) 給記錄下來，並且進一步提供效能調校的建議。</p><p>而Atlas則直接提供Dashboard將Profiler資訊以圖形化介面的方式作呈現，非常方便，一目瞭然。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*BdWN4eKf7ZWuYUUDmw2fAQ.png" /></figure><p>同時亦提供Performance Advisor，會建議哪些Index 需要建立，可以提昇多少百分比的效能，也可以建議哪些Index沒有使用到需要被移除。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*t3k0Kuqe0_p6qYjNEfiA8Q.png" /></figure><h4>3–3. 備份還原服務</h4><p>除了高可用以外，MongoDB亦提供持續的資料庫備份，確保資料不遺漏。</p><p>備份需要注意的是週期，我們可以透過客制備份週期與量來做到最適的成本效益比。</p><p>而當你需要還原的時候，亦可以指定一個新的Atlas Cluster還原，來讓使用上更增彈性。</p><h4>3–4. 免費線上搬移服務</h4><p>開始對於 Atlas 感興趣了嗎？</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*M3RZ9zA2DuPNXNz-8y3T9g.png" /></figure><p>MongoDB Atlas 提供一個免費的線上搬移服務叫做 <a href="https://www.mongodb.com/cloud/atlas/migrate">Live Migrate</a>，可以讓你自建的MongoDB即時的與Atlas做抄寫同步，等待抄寫一至後只要切換應用程式的連線 就可以完成搬移了，有感覺心動嗎？ 快來一起轉生使用MongoDB Atlas 吧！！！</p><h3>4. Atlas 資料平台策略：</h3><p>Atlas 不僅僅提供 MongoDB 作為資料庫引擎，同時還提供了許多周邊的服務將Atlas完善成一個資料平台。</p><pre>Atlas API - Infra structure as a Code服務</pre><pre><a href="https://askstw.medium.com/mongodb-atlas-search-basic-4769816e48aa">Atlas Search</a> - 文字檢索服務</pre><pre>Atlas Online Archive &amp; Data Lake - 資料湖泊服務</pre><pre>MongoDB Realm - 手機資料庫與事件驅動服務</pre><pre>Charts - 視覺化報表服務</pre><p>而後續，我會依序再跟各位介紹這些實用的資料服務～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*ZncP9rhMlQ3F0wSO14Vg9w.png" /></figure><h3>關於 MongoDB Atlas</h3><h4><strong>Atlas 是由 MongoDB Inc. 直接營運的雲端資料庫服務</strong></h4><p>能夠在AWS, AZURE, GCP 上多達80個區域部署MongoDB，也可以將已經部署好的MongoDB做不停機的跨區或是跨雲移轉。</p><p>Atlas 滿足了雲端資料庫的所有需求，例如 權限/網路/備份/安全/自動化等功能，因此也廣受全球兩萬多個客戶喜愛，現已在Atlas上建立了超過一百萬套MongoDB (台灣的使用者也貢獻不少XD)。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a286dea1945" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Re:從零開始的MongoDB Atlas生活]]></title>
            <link>https://askstw.medium.com/re-mongodb-atlas-b331acd3d7c?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b331acd3d7c</guid>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Fri, 21 May 2021 08:47:20 GMT</pubDate>
            <atom:updated>2021-05-21T08:47:20.653Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>想要在Cloud使用MongoDB的使用者，MongoDB Atlas會是你最好的選擇。</blockquote><blockquote>MongoDB 源自開源，所以雲端的MongoDB Atlas也很佛心，能夠提供永久免費的MongoDB集群給大家使用，所以接下來就由我來推坑大家快速了解並使用MongoDB Atlas吧！</blockquote><h3>MongoDB Atlas 簡介</h3><h4>MongoDB Atlas (以下簡稱Atlas) 由 MongoDB Inc公司直接營運</h4><p>不同於一般Cloud資料庫，你可以自由地在AWS, AZURE, GCP 上多達80個區域部署使用MongoDB，所以也可以自由地將已經部署好的MongoDB做線上的跨區域部署或是跨雲搬移。</p><p>同時Atlas亦滿足了雲端資料庫的所有需求，例如 權限/網路/備份/安全/自動化 等功能，因此也廣受全球兩萬多個客戶喜愛，現已在Atlas上建立了超過一百萬套MongoDB (台灣區域也貢獻不少XD)。</p><p>對於初入Atlas的用戶，相信對於Atlas的介面多少都不太熟悉，我也很常收到類似的問題與疑惑，所以接下來我將會簡單的整理Atlas的主要功能來跟大家分享。</p><h3>如何開始免費使用Atlas ?</h3><h4>註冊帳號並登入Atlas Portal</h4><p>首先，輸入網址 <a href="https://www.mongodb.com/cloud/atlas">https://www.mongodb.com/cloud/atlas</a> 即可開始您的 Atlas 之旅。</p><p>你會需要申請一組帳號, 或是使用Gmail認證登入即可 , 不需要信用卡之類的。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIcpSV1-W9Ht1xTZ7T50_w.png" /></figure><h4>開始你的第一個Organization &amp; Project</h4><p>註冊完成後會被要求創建一個屬於自己的Organization, 這個組織就是Atlas帳戶的最上層，在其之下則是 Project。</p><p>如果把Organization想像成一個公司或是一個部門，而Project就是專案或是環境，例如正式環境/測試環境/開發環境等等。</p><p>所以創建完Organization後還需要創建Project才能使用MongoDB集群。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m1Effxq94G0FUhDTgufdlA.png" /><figcaption>首先需要建立一個Organization</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*ZKE159TK7qnDnaMYwmzv9w.png" /><figcaption>選擇建立 MongoDB Atlas</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*fwGSXa4-zPQ1Kk0keYJFKA.png" /><figcaption>在Organization之下建立一個Project, 才能開始建立MongoDB集群</figcaption></figure><h4>建立一個/多個屬於自己免費的集群</h4><p>當Organization &amp; Project 準備好後，就可以來建立免費的MongoDB集群了！</p><p>目前的Policy是每個Project只能建立一個免費的集群，所以如果想要多個免費MongoDB來使用，是需要建立多個Project的喔。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*DL3yb-QoieRYyuE2XYqIoQ.png" /><figcaption>點選 Build a Cluster 建立免費的集群</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*qs2FfRW2tP72zMrXyLol6w.png" /><figcaption>選擇 Create a cluster (FREE)</figcaption></figure><h4>選定偏好的雲端區域</h4><p>目前免費集群(M0)只有在特定的區域有，很幸運有GCP台灣，如果想要別的雲端，AWS新加坡，AZURE香港也可以做選擇。</p><p>之後填好cluster name，永久免費使用的MongoDB集群就完成了！！</p><p>(建立時需注意cluster name不可更改)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*7rY5Di9rIg-OrRF4t8OeNQ.png" /><figcaption>建立時需注意cluster name不可更改</figcaption></figure><h3>連線至Atlas</h3><p>建立免費集群(M0)後，通常需要1~3分鐘的部署時間，這個時候讓我們來做環境準備，<strong>設定帳號與網路</strong>吧。</p><h4><strong>1.設定帳號</strong></h4><p>選擇左方 Database Access，你需要在這裡建立資料庫帳號</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*JOsc7qZzoy0I7CPypn3bgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*l-s6BWTurluL3f-xiugRXQ.png" /><figcaption>使用基礎的Password驗證，建立使用者</figcaption></figure><h4>2.設定網路</h4><p>選擇左方的Network Access，你需要在這裡建立IP White List</p><p>如果想要使用 Cloud Network Peering/Private Endpoint，很可惜目前並不支援於免費集群，需要升級集群才能使用。</p><p>所以我們將使用Public IP access 免費的MongoDB集群。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*ss7014Hres1fiJGU91yl5A.png" /><figcaption>免費的集群只能使用Public IP存取，需要設定白名單才能連線</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*W23urh_ScmrJXzSKiszJQw.png" /><figcaption>想要偷懶的話，亦可設定0.0.0.0，但是需要注意風險，切勿存放敏感資料。</figcaption></figure><h4>3.選擇連線</h4><p>選擇左方的cluster，這個時候集群應該已經準備好了，選擇<strong>Connect</strong> 就可以開始使用MongoDB了。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*6wKh6Q20roIAtyRFisa5eA.png" /></figure><p><strong>TLS安全連線模式</strong></p><p>Atlas 必需要透過 <a href="https://docs.atlas.mongodb.com/reference/faq/security/#can-i-disable-tls-on-my-deployment-">Transport Layer Security (TLS)</a> 進行安全連線，目前預設使用 TLS 1.2 以上的版本，最低可以降到TLS 1.0。</p><p><strong>SRV連線模式</strong></p><p>有別於一般自己安裝的MongoDB集群，Atlas特別提供了<a href="https://developer.mongodb.com/article/srv-connection-strings/">SRV服務</a>，可以做到集群連線時的流量負載平衡，也終於在連線的時候不用輸入一長串IP 。</p><p>也可以把下方連線的shell版本調整到3.4, 就會跳出大家熟悉的長長一串的連線字串。</p><pre><strong>連線字串比較：<br></strong></pre><pre><strong>SRV : </strong><br>  &quot;mongodb+srv://tw.cy17l.mongodb.net/myFirstDatabase&quot; --username arktw</pre><pre><strong><br>一般 : </strong><br>  &quot;mongodb://tw-shard-00-00.cy17l.mongodb.net:27017,tw-shard-00-01.cy17l.mongodb.net:27017,tw-shard-00-02.cy17l.mongodb.net:27017/myFirstDatabase?replicaSet=atlas-rtaiss-shard-0&quot; --ssl --authenticationDatabase admin --username arktw --password &lt;password&gt;</pre><h3>集群功能介紹</h3><p>Atlas除了提供資料庫服務以外還有提供許多功能，只要點選上方小小的cluster name ”tw” 就可以看到集群更多的資訊，我這邊簡單敘述一下有哪些好用功能。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*bnl8Qf1esFjxZuMarpfNJQ.png" /></figure><p><strong>Overview</strong> : 快速地查看集群健康狀態與現在的使用量</p><p><strong>Real Time</strong> : 可以看到 MongoDB 即時的交易資訊(mongotop&amp;mongostat)，但是免費版沒有提供 (嘶)。</p><p><strong>Metrics</strong> : 可以看到 MongoDB 軟硬體的多達數十種的各項指標，能夠自由選擇區間做比較，但是免費版幾乎沒有 (嘶)。</p><p><strong>Collections</strong> : 能夠透過 UI 的方式查看並管理 collection。</p><p><strong>Search</strong> : Search 功能，詳細請參考另一篇拙著 <a href="https://askstw.medium.com/mongodb-atlas-search-basic-4769816e48aa">MongoDB Atlas Search</a> 。</p><p><strong>Profiler</strong> : 搜集slow command呈現哪些指令跑得慢，免費版沒有提供 (啊) 。</p><p><strong>Performance Advisor</strong> : 提供效能調校索引建議 ，免費版沒有提供 (啊)。</p><p><strong>Backup</strong> : 備份還原的功能，免費版沒有提供 (囧)。</p><p><strong>Online Archive</strong> : Data Lake 功能，詳細會另外做一篇文章做分享。</p><p><strong>Command Line Tolls</strong> : 可使用<a href="https://docs.mongodb.com/database-tools/">MongoDB Database Tools</a>做import/export, dump/resotre。</p><h3>More on Atlas …</h3><p>以上就是 Atlas 免費入門的使用分享，目前有些很實用功能是免費版沒有提供的，所以就不在這裡贅述。</p><p>我會另外寫一篇文章專門再做進階分享，讓付費的使用者們也能夠更加了解Atlas。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0J7l_CW7WMV0zWyARs0d6g.png" /></figure><h3>關於 MongoDB Atlas</h3><blockquote><em>MongoDB Atlas是由MongoDB公司直營的雲端資料庫服務，能夠免費創建多組MongoDB集群於AWS,AZURE,GCP三個公有雲，並且永久免費使用 (只限制可用資源)。</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b331acd3d7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[「MongoDB 實用功能分享」- MongoDB Atlas Search 基礎篇]]></title>
            <link>https://askstw.medium.com/mongodb-atlas-search-basic-4769816e48aa?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4769816e48aa</guid>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-atlas-search]]></category>
            <category><![CDATA[mongodb-taiwan]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Fri, 07 May 2021 08:01:10 GMT</pubDate>
            <atom:updated>2021-05-07T08:01:10.214Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>今天要來談論的是 MongoDB Atlas 的新功能 Atlas Search — 全文檢索引擎，以及如何透過 MongoDB Atlas Search 來快速打造永久免費的中文搜尋引擎。</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*EXz7M_L44oO9HTqSwm_AkQ.png" /></figure><h3><strong>緣起</strong></h3><p>為什麼想寫這篇文章呢？ 實際上全文檢索的應用充斥在你我的身邊，從常見的搜尋引擎到購物網站的商品搜尋處處可見，各大網站如 Google/Facebook/LinkedIn/Netflix 等都有許多搜尋相關的應用。</p><p>而 MongoDB Atlas新推出的Atlas Search功能，能夠在MongoDB Atlas上直接進行”中文”的全文檢索，這讓我們在應用上更方便，更快速，更直覺。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*AAsjYVJ3ptN4mcVi6yFkSA.png" /></figure><h4><strong>支援中文搜尋</strong></h4><p>沒錯，MongoDB終於能夠用中文進行文字搜尋了，這是對於一個不是以搜尋引擎著名的資料庫來說是非常大的突破！</p><p>有別於MongoDB 3.2版開始提供的Text Search, MongoDB Atlas Search只能在MongoDB Atlas 4.2版以上使用，而且是透過內建Apache Lucune引擎來做全文檢索 (沒錯！你知道的那個！)。</p><h4>Atlas Search vs Text Search</h4><p>Atlas Search與Text Search在功能上會有些微的不同，以下是MongoDB目前提供兩種Search的簡單比較表。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pjZHDtM20Mq6OpcPB-4utw.png" /></figure><h3><strong>為何推薦 Atlas Search</strong></h3><p>以往大部分的搜尋都是使用專門的資料庫如 ElasticSearch, Solr來實現，但是企業主要的資料庫通常都不會是以上兩種，所以可想而知當資料需要被搜尋的時候，還要透過同步抄寫的方式把資料丟到搜尋資料庫才能做全文檢索。</p><pre>例如以下AWS分享如何透過DynamoDB Streams+Lambda+ElasticSearch打造搜尋引擎，就是在分享該如何透過一系列的方式設定並且實現資料自動化抄寫，但其本質上只是減少了一直資料庫抄寫的操作步驟，但並沒有省略其仍為需要人力介入的事實，<strong>仍然需要管理兩套資料庫，使用兩種連線與兩種程式碼</strong>。</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*h-fJphXB66QDvrmIkg-W6w.png" /><figcaption><a href="https://aws.amazon.com/tw/blogs/compute/indexing-amazon-dynamodb-content-with-amazon-elasticsearch-service-using-aws-lambda/">https://aws.amazon.com/tw/blogs/compute/indexing-amazon-dynamodb-content-with-amazon-elasticsearch-service-using-aws-lambda/</a></figcaption></figure><h4>Atlas Search 如何運作</h4><p><strong>如果一套資料庫就能做到的功能，何必要組裝多個服務增加複雜度呢？</strong></p><p>於是Atlas 從 4.2版開始做了一個很大的功能突破，也就是內建Apache Lucene，能夠直接進行完整的全文檢索。</p><p>對於使用者而言，無需再設定任何的資料移轉，無需再切換連線或是使用不同的資料庫操作語言，使用更方便，檢索更即時。</p><pre>例如：我們可以用<strong>搜尋</strong>來篩選出感興趣的用戶，並且透過<strong>查詢</strong>來了解這些客戶的價值，進一步貼上標籤來實現精準營銷，而這些只需要簡單的資料庫語句。</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*ygm-6XdORKqf_Z-Lat0ytQ.png" /></figure><h4>Atlas Search 搜尋功能</h4><p>現行 Atlas Search 能夠實現大多數市面上常見的搜尋功能 例如Text Search, Autocomplete, Highlighting, Fuzzy matching, Scoring 等等。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*DB_xqMchNk8wJcKDuNKXzA.png" /><figcaption>拜Lucene所賜，Atlas Search能夠實現大多數搜尋功能。</figcaption></figure><h3>開始嶄新的搜尋之旅</h3><p>所以接下來我將全程手把手的教學，帶領著大家透過 Atlas Search 快速打造一個永久免費的全文檢索引擎。</p><pre>今天的旅程將參考 Atlas Search <a href="https://docs.atlas.mongodb.com/reference/atlas-search/tutorial/">範例</a></pre><h4><strong>1.準備Atlas環境</strong></h4><p>首先我們需要在Atlas上面建立一個免費的集群，並且Load Sample Dataset, 因為接下來將會使用Movie Data作為演示，由於篇幅的關係關於Atlas的基礎操作就先跳過。</p><pre>如果對於 Atlas 還不夠熟悉，可以參考我之前的 Webinar : <a href="https://www.mongodb.com/presentations/mongodb-atlas-online-workshop-taiwan">MongoDB Atlas Onlie Workshop</a> ，可以幫助大家快速熟悉介面與操作。</pre><h4>2.建立Search Index</h4><p>使用Atlas Search非常的簡單，其實從頭到尾只要做一件事情，就是建立Search Index，然後就能夠進行全文檢索。</p><p>而 Atlas Search Index 使用的是 <strong>Lucene Index (inverted index)</strong> ，也是依賴Analyzer進行分詞存放與索引，有用過搜尋資料庫應該都不陌生。</p><pre>註：關於Analyzer的說明，我會留在下一篇 &quot;Atlas Search : 延伸使用&quot; 作補充</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*cNV2Y5JpFmQhS9fqXh2QwQ.png" /></figure><p>我們會使用MongoDB Atlas的Sample Dataset當中的Movie collection來做電影的 標題/類型/大綱 的搜尋。</p><p>目前提供兩種建立Index有方式，Visual與JSON，兩種格式互通，可以互相轉換。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*5HBvsYB72LZSrJpxft0ZVQ.png" /></figure><p>我們將使用JSON Editor, 並且選定namespace: sample_mflix.<strong>movies</strong>, 輸入indexname:<strong>json</strong>, 然後輸入下段JSON文字以建立search index。</p><pre>{<br>  &quot;mappings&quot;: {<br>    &quot;dynamic&quot;: false,<br>    &quot;fields&quot;: {<br>      &quot;title&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;analyzer&quot;: &quot;lucene.standard&quot;,<br>        &quot;multi&quot;: {<br>          &quot;keywordAnalyzer&quot;: {<br>            &quot;type&quot;: &quot;string&quot;,<br>            &quot;analyzer&quot;: &quot;lucene.keyword&quot;<br>          }<br>        }<br>      },<br>      &quot;genres&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;analyzer&quot;: &quot;lucene.standard&quot;<br>      },<br>      &quot;plot&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;analyzer&quot;: &quot;lucene.standard&quot;<br>      }<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*zcTcs1QXLmuizm-StYcm-w.png" /></figure><p>觀察Index建立的狀況，Index建立完成後就可以使用Atlas Search了！</p><pre>註：免費的Tier 最多只能建立三組 Search Index</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*j5Ia2wMCi936SE54PG2gtw.png" /></figure><h4>3.開始搜尋</h4><p>之前提過，使用Atlas Search的優點就是使用同樣的語言進行查詢與搜尋，所以在下面的範例中，我們將使用MongoDB的Aggregation Pipeline進行。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*3Q-1VjC8pJH3WogW3m2h0w.png" /></figure><p><strong>查詢語法範例</strong></p><pre>//查詢電影的<strong>類型</strong>必須為<strong>&quot;Comedy&quot;</strong>或<strong>&quot;Drama&quot;</strong></pre><pre>use sample_mflix;<br>db.movies.aggregate([{$match: { genres: {$in: [&quot;Comedy&quot;, &quot;Drama&quot;]}}}]);</pre><p><strong>搜尋語法範例</strong></p><pre>//搜尋電影的<strong>大綱</strong>類似<strong>&quot;baseball&quot;<br>//需指定indexname為剛剛建立的json</strong></pre><pre>use sample_mflix;<br>db.movies.aggregate([{<strong>$search</strong>: { &quot;index&quot;:&quot;json&quot;, &quot;text&quot;: { &quot;query&quot;:&quot;baseball&quot;, &quot;path&quot;:&quot;plot&quot;}}}]);</pre><p><strong>進階搜尋</strong></p><pre><strong>//搜尋情節有夏威夷或阿拉斯加，具有年代敘述，風格為喜劇或浪漫，標題有海灘或雪的電影</strong></pre><pre>use sample_mflix;<br>db.movies.aggregate([<br>  {<br>    $search: {<br>      &quot;index&quot;:&quot;json&quot;,<br>      &quot;compound&quot;: {<br>        &quot;must&quot;: [ {<br>          &quot;text&quot;: {<br>             &quot;query&quot;: [&quot;Hawaii&quot;, &quot;Alaska&quot;],<br>             &quot;path&quot;: &quot;plot&quot;<br>          },<br>        },<br>        {<br>          &quot;regex&quot;: {<br>             &quot;query&quot;: &quot;([0-9]{4})&quot;,<br>             &quot;path&quot;: &quot;plot&quot;,<br>             &quot;allowAnalyzedField&quot;: true<br>          }<br>        } ],<br>        &quot;mustNot&quot;: [ {<br>          &quot;text&quot;: {<br>            &quot;query&quot;: [&quot;Comedy&quot;, &quot;Romance&quot;],<br>            &quot;path&quot;: &quot;genres&quot;<br>          }<br>        },<br>        {<br>          &quot;text&quot;: {<br>            &quot;query&quot;: [&quot;Beach&quot;, &quot;Snow&quot;],<br>            &quot;path&quot;: &quot;title&quot;<br>          }<br>        } ]<br>      }<br>    }<br>  },<br>  {<br>    $project: {<br>      &quot;title&quot;: 1,<br>      &quot;plot&quot;: 1,<br>      &quot;genres&quot;: 1,<br>      &quot;_id&quot;: 0<br>    }<br>  }<br>]);</pre><h4>4.延伸使用</h4><p>由於篇幅的關係，關於Atlas Search進階的內容例如Fuzzy, Auto Complete, Custom Analyzer, 以及中文檢索等, 就留到下次持續跟大家分享了！</p><h3>結語</h3><p>Atlas Search屬於非常容易上手使用的功能，簡單實用，如果之前有搜尋相關的經驗，一定會有非常強烈的即視感(XD)。</p><p>但整體而言，這也是MongoDB Atlas持續提升用戶體驗的一個方式，希望能夠持續提供更多更好的功能來服務用戶。</p><blockquote>Atlas Search是MongoDB Atlas在提供雲端資料庫的範疇內，從MongoDB Core Engine延伸出來專門針對全文檢索加強的功能，目前此功能也已經上線運作接近一年的時間，在功能與效能上都相對的穩定可用。</blockquote><blockquote>關於Atlas Search的功能演進，可持續關注<a href="https://docs.atlas.mongodb.com/reference/atlas-search/changelog/">Change Log</a>。</blockquote><h3>關於 MongoDB Atlas</h3><blockquote>MongoDB Atlas是由MongoDB公司直營的雲端資料庫服務，能夠免費創建一組MongoDB集群於AWS,AZURE,GCP三個公有雲，並且<strong>永久免費使用</strong> (只限制可用資源)。</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4769816e48aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB Certification Study Guide]]></title>
            <link>https://askstw.medium.com/mongodb-certification-study-guide-1fc53196eea6?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fc53196eea6</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-study-guide]]></category>
            <category><![CDATA[mongodb-certified]]></category>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 07:08:51 GMT</pubDate>
            <atom:updated>2021-05-07T02:40:49.867Z</atom:updated>
            <content:encoded><![CDATA[<h3>MongoDB Certification Study Guide / MongoDB 證照考試指南 重點整理（下）</h3><blockquote><em>本文是</em> MongoDB Certified Study Guide（下），主要分享認證考試重點，幫助大家快速應試考取證照。</blockquote><blockquote>由於內容較多，本篇僅介紹 <em>Replication, Sharding, Application &amp; Server Administration (DBA Only), Storage Engine, Glossary</em>。</blockquote><blockquote>其餘的包括 Philosophy and Features, CRUD, Indexes 與 Aggregation (Developer Only) ，請參考<a href="https://askstw.medium.com/mongodb-study-guide-mongodb-%E5%82%99%E8%80%83-%E8%A6%81%E9%BB%9E-%E4%B8%8A-6cd3259a6bbf">上篇</a>。</blockquote><blockquote>MongoDB Certified Intro 請參考<a href="https://askstw.medium.com/mongodb-certification-intro-mongodb-%E8%AA%8D%E8%AD%89%E6%8C%87%E5%8D%97-57c3653d0b1b">於此</a>。</blockquote><blockquote>MongoDB Certified Overview 請參考<a href="https://askstw.medium.com/mongodb-certification-overview-448718bec20e">於此</a>。</blockquote><h4>開始之前</h4><p><a href="https://university.mongodb.com/dashboard/exams">Practice Exams</a> 記得多做，可以幫助你大致了解考試題型以及比較不足的地方，也比較好做針對性的補強。</p><h4>記得準備 <a href="https://university.mongodb.com/exam/guide">Certification Study Guide</a></h4><p>接下來會帶著大家複習考試要點，這是我在準備認證的時候整理的Study Guide，會從中挑出比較重要的部分跟大家做分享。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*p_lw0EbpPwKDNBcFjqkatg@2x.jpeg" /></figure><h3>Glossary</h3><p><strong>概述</strong></p><pre>有空把 <a href="https://docs.mongodb.com/manual/reference/glossary/">Glossary</a> 看一遍,大概會出2題<br>  有些少見的名詞如：idempotent, snappy, term, zlib, zstd 大概懂就好</pre><h3>Storage Engine</h3><p><strong>概述</strong></p><pre>大概會出2題，詳細有點忘了，主要幾個觀念懂就好。</pre><pre>現行主要的storage engine是 WiredTiger 與 In-memory (MongoDB Enterprise才有)，至於MMAPv1已經被遺棄無法再用了。</pre><h4>WiredTiger :</h4><pre>預設存儲引擎，屬於 <strong>Document Level Concurrency</strong></pre><pre>預設壓縮方式：<br>  <strong>snappy</strong> compression library for all collections.<br>  <strong>prefix</strong> compression for all indexes.</pre><pre>可選壓縮方式：<br>  zlib/zstd</pre><pre>預設大小：<br>  256MG or 50% (RAM - 1 GB)<br>    可透過 --wiredTigerCacheSizeGB 設定大小</pre><h4>Journal :</h4><pre>MongoDB 交易日誌<br>  Recover Data After Unexpected Shutdown On a restart after a crash。<br>  由於WiredTiger每60秒才寫入一次硬碟，在這之間若出現異常則需要透過Journal Log來做資料復原。</pre><pre><strong>預設開啟，在Replica Set中則為必需開啟<br>  </strong>每100ms 寫入一次disk, journal log 大小為 100mb</pre><pre>若使用 write concern : majority 或是寫入設定 j : true<br>  每次寫入 都寫入disk</pre><h3>Tools</h3><p><strong>概述</strong></p><pre>大概看一下 <a href="https://docs.mongodb.com/tools/">MongoDB Tools</a> 的工具有哪些, 應該會考1題左右。</pre><pre><strong>mongoimport</strong>/<strong>mongoexport</strong> :<br>  預設格式為JSON, 可以指定CSV (--type=csv)</pre><pre><strong>mongodump/mongorestore</strong> :<br>  使用格式為BSON</pre><pre><strong>mongostat</strong> :<br>  呈現整體crud資訊，包含insert/update/delete/getMore/command 等</pre><pre><strong>mongotop</strong> : <br>  呈現hot collection的read/write資訊</pre><h3>Replication</h3><p><strong>概述</strong></p><pre>大概會出6~10題，看考的是Developer還是DBA</pre><pre>Replication這個部分考得比較細，會考使用目的(高可用異地備援)，資料抄寫的方式(Statement Based)，如何判斷主從節點(db.isMaster())，如何取得集群狀態(rs.status())，節點特性(arbiter, hidden)，集群設定(rs.config()) 等等</pre><h4>rs常用語法 :</h4><pre><strong>rs狀態檢查指令,資訊豐富程度<br>    </strong>rs.status() &gt;= db.isMaster() &gt;= db.serverStatus()[&#39;repl&#39;]</pre><pre><strong>rs如何在從節點操作</strong><br>  rs.slaveOk()<br>    可以在從節點進行讀取或是建立index, 無法寫入資料<br>  db.isMaster()<br>    可以在任何節點查詢節點狀態</pre><pre><strong>rs參數檢查</strong><br>  cfg = rs.config()<br>    更改 cfg 後， 使用 rs.reconfig(cfg) 更新設定<br>      更新後 config.version 的值會 +1</pre><pre><strong>rs新增節點</strong><br>  rs.add(&quot;host:port&quot;)</pre><pre><strong>rs新增仲裁</strong><br>  rs.addArb(&quot;host:port&quot;)</pre><pre><strong>rs主從切換 failover</strong><br>  rs.stepDown()</pre><h4>rs 參數設定 :</h4><pre>需要知道rs有哪些從節點類型，其行為模式以及如何配置<br>  所以大致上要知道每個參數在做什麼，能記就記</pre><pre><strong>Arbiter</strong> - 仲裁者<br>  vote 必為 1, priority 預設 0, 可為 1<br><strong>Delayed</strong> - 延遲節點<br>  priority 必為 0, 可以 vote<br><strong>Hidden</strong> - 隱藏節點<br>  priority 必為 0, 可以 vote<br>  db.isMaster() 不會呈現出資訊</pre><pre><strong>votes</strong><br>  0 or 1, 最多能有七個投票節點<br>  大於零才能acknowledging write operations with majority<br><strong>priority</strong><br>  0~1000, 0的話代表無法變成Primary, 1以上的話 votes必須大於0<br><strong>tag</strong><br>  讀取偏好 tag<br></pre><pre><strong>rs.config()</strong><br>  _id: &lt;string&gt;,<br>    <strong>version</strong>: &lt;int&gt;,<br>    <strong>term</strong>: &lt;int&gt;,<br>    <strong>protocolVersion</strong>: &lt;number&gt;,<br>    writeConcernMajorityJournalDefault: &lt;boolean&gt;,<br>    configsvr: &lt;boolean&gt;,<br>    <strong>members</strong>: [{<br>      <strong>_id</strong>: &lt;int&gt;,<br>      <strong>host</strong>: &lt;string&gt;,<br>      <strong>arbiterOnly</strong>: &lt;boolean&gt;,<br>      <strong>buildIndexes</strong>: &lt;boolean&gt;,<br>      <strong>hidden</strong>: &lt;boolean&gt;,<br>      <strong>priority</strong>: &lt;number&gt;,<br>      <strong>tags</strong>: &lt;document&gt;,<br>      <strong>slaveDelay</strong>: &lt;int&gt;,<br>      <strong>votes</strong>: &lt;number&gt;<br>    }]</pre><h4>Oplog :</h4><pre>俗稱交易日誌, 是statement based抄寫<br>  Primary執行deleteMany指令, Secondary可能會收到0~N行異動的語法.<br>  rs的節點之間主要透過oplog做資料同步</pre><pre>oplog的狀態<br>  db.oplog.rs.stats()<br>  rs.printReplicationInfo()</pre><pre>oplog的存放位置<br>  local.oplog.rs<br>oplog的可用空間<br>  5% disk space, 下限990MB ~ 上限 50GB<br>  屬於 capped collection 有固定大小, 所以最舊的交易日誌會一直被清掉</pre><h4>rs 讀寫偏好 :</h4><pre>只要記得有這些偏好設定就好，詳細的行為能記再記</pre><pre>Read Preference : <br>  primary, primaryPreferred, secondary, secondaryPreferred, nearest</pre><pre>Read Concern : <br>  local, available, majority, linearizable, snapshot</pre><pre>Write Concern : <br>  預設為 1 , 通常建議 majority (過半數)<br>    wtimeout 預設為 0ms, 代表會持續等待寫入acknowledge</pre><h4>rs 投票機制 :</h4><pre>在下列情況下，會觸發rs選舉機制 (不一定會切換)<br>  initiating a replica set<br>  Adding a new node to the replica set<br>  rs.stepDown() / rs.reconfig()<br>  timeout<br>    settings.electionTimeoutMillis //切換判斷時間，預設1000ms<br>      補充 Heartbeats 機制是每兩秒一次</pre><h3>Sharding</h3><p><strong>概述</strong></p><pre>大概會出8~10題，看考的是Developer還是DBA</pre><pre>Sharding這個部分算挺簡單的，會考為何需要sharding(分散讀寫，提升效能，提升備份還原效率)，sharding的組成(mongoS, mongoD, config Server)，sharding設計實作(如何選擇shard key)，與sharding的維運(看懂chunk, 搬移chunk)，以及primary shard的額外功能 等等</pre><h4>Sharding Basics :</h4><pre><strong>Sharding 狀態檢查</strong><br>  sh.status()<br>  db.collection.getShardDistribution()</pre><pre><strong>Shard key 選擇</strong><br>  High Cardinality, Low Frequency, Non-Monotonically<br>  必需先建立為index, 才能建立為shard key (shard collection by shard key)</pre><pre><strong>Sharding 種類<br>  </strong>Range sharding, Hash sharding</pre><pre><strong>Primary shard 行為</strong><br>  stores unsharded collection<br>  aggregation stages : $out, $facet, $lookup</pre><pre><strong>Aggregation on shards<br>  </strong>$sort : push sort to each shard and merge sorts (在mongoS裡面跑)<br>  $limit : pass limit to each shard and limit after merge (從各shard抓取limit+skip數量的資料)<br>  $skip : perform skip after merge (從各shard抓取unskip資料, skip不會在shard上做)<br>    db.movies.find({&quot;cast&quot;: &quot;Meryl Streep&quot;}).sort({&quot;year&quot;:1}).skip(100).limit(20)<br>      route, sort_by_shard, limit_by_shard, sort_by_mongos, skip_by_mongos, limit_by_mongos<br>      在各shard應該要提供100+20個彙整到mongos 確保足夠</pre><pre><strong>Unique</strong><br>  only _id or shard key prefix can be unique</pre><h4>Chunks :</h4><pre><strong>Chunk 分佈<br>  </strong>透過 sh.status() 指令做查詢，<br>    需注意chunk range 右邊邊界是小於, 左邊邊界是大於等於<br>      chunk Lower bound is inclusive, Upper bound is exclusive.<br>  <br>  需看懂chunk分佈<br>    以下的範例， productId 9294 會在 shard0002 <br>  { &quot;productId&quot; : { &quot;$minKey&quot; : 1 } } --&gt;&gt; { &quot;productId&quot; : 9294 } on : shard0000 { &quot;t&quot; : 2, &quot;i&quot; : 0 }                          <br>  { &quot;productId&quot; : 9294 } --&gt;&gt; { &quot;productId&quot; : 18684 } on : shard0002 { &quot;t&quot; : 3, &quot;i&quot; : 0 }</pre><pre><strong>Chunk Migration<br></strong>  透過balancer做搬移，balancer可以被stop與start<br>  最多同時 n/2 (rounded down) chunk migrations<br>  搬移的過程是先複製一份過去再切換，期間所有讀寫依然在原shard。</pre><pre><strong>Jumbo Chunk<br>  </strong>chunk size 預設最大為64(MB), 滿了會自動split, 若無法split的就是jumbo chunk<br>  自動被標注，不能被移動，不會被Balance，可以被手動拆分</pre><h3>Application &amp; Server Administration (DBA Only)</h3><p><strong>概述</strong></p><pre>加起來大概會出20題</pre><pre>基本上這部分就是背多分，內容繁雜瑣碎，把相關參數都背起來就對了。</pre><pre><a href="https://docs.mongodb.com/manual/reference/configuration-options/">CFG File</a> 能熟讀就熟讀</pre><pre><a href="https://docs.mongodb.com/manual/reference/configuration-file-settings-command-line-options-mapping/">Command Line Mapping</a> 也要讀懂，某些參數對應需要搞清楚<br>  例如開啟auth在CFG裡面需要設定security.authorization : enabled<br>    而透過mongod則是使用 mongod --auth</pre><h4>Configuration :</h4><pre><strong>CFG 基本參數</strong> <br>  systemLog:<strong><br>    </strong>destination: file<br>    path: &quot;/var/log/mongodb/mongod.log&quot;<br>  storage:<strong><br>    </strong>dbPath: /data/db<br>  processManagement:<strong><br>    </strong>fork: true <br>      // 需要有logpath才能設定fork<br>  net:<strong><br>    </strong>bindIp: localhost<br>    port: 27017</pre><pre><strong><br>啟用 Authorization (Authentication)<br>  </strong>security:<strong><br>    </strong>authorization: enabled <br>      // 使用authorization等同開啟authentication, 使用內建的SCRAM-SHA-1<br>      <strong>// localhost expection : 能使用local連線, 建立&quot;一個&quot;使用者帳號<br></strong></pre><pre><strong>密鑰 Key Generation</strong><br>  主要使用openSSL, key的長度位於6~1024字元<br>    openssl rand -base64 (6~1024) &gt; mongodb-keyfile<br>    openssl x509 -in client.pem -inform PEM -nameopt RFC2253 -text<br>      // in 輸入檔案, inform 檔案格式, text 內容, nameopt 列印方式<br></pre><pre><strong>啟用 TLS (SSL)</strong><br>  // 4.0版以前是SSL, 4.2版以後為TLS<br>  net: <strong><br>    </strong>tls:<br>      mode: requireTLS<br><strong>        // 模式差別要搞清楚, requireTLS, preferTLS, allowTLS, disabled</strong><br>      certificateKeyFile: <br>         // 同時包含TLS / SSL證書和mongo外殼密鑰的文件。<br>      CAFile: <br>        // 包含來自證書頒發機構的根證書鏈的文件。<br>      clusterFile:<br>        // -- tlsAllowInvalidCertificates 讓不合法的tls連線<br></pre><pre><strong>啟用 X.509 Authentication (需同時啟用TLS)<br>  </strong>net:<br>    authenticationDatabase: &#39;$external&#39;<br>    authenticationMechanism: MONGODB-X509<br>    // 啟用X.509等同開啟authorization<br></pre><pre><strong>啟用 Replicaset 之間的 Authentication (需同時啟用TLS)<br>  </strong>security:<br>    keyFile: /<br>    clusterAuthMode: keyFile / x509<br></pre><pre><strong>啟用 Encryption at Rest<br>  // </strong>僅支援 WiredTiger, 共用Master Key, 每個資料庫有獨立的data key<br>  security:<br>    enableEncryption: true<br>    encryptionKeyFile: <br>    kmip:<br>      serverName:<br>      RotateMasterKey:<br></pre><pre><strong>啟用 Audit<br>  </strong>auditLog:<br>    destination: file / syslog / console<br>    format: JSON / BSON<br>    path: /<br>    filter: &#39;{ atype: { $in: [ &quot;createCollection&quot;, &quot;dropCollection&quot; ] }, &quot;param.ns&quot;: /^test\\./ } }&#39;</pre><pre>    <strong>// 預設不紀錄DML (CRUD)，設定atype為authCheck才能紀錄</strong><br>      // auditAuthorizationSuccess為true，才紀錄所有DML<br>      // 如果是false只記錄auth失敗<br>        // atype: authenticate, <strong>authCheck</strong>, createCollection, createIndex, createUser, createRole, replSetReconfig, shardCollection<br></pre><pre><strong>啟用 Log Rotate<br>  systemLog:<br>    </strong>logAppend:  預設 false<br>      //mongod重啟後是否繼續寫入同樣log<br>    logRotate:  預設 rename<br>      //開啟新的log檔案<br>  <strong>security:<br>    </strong>redactClientLogData:<br>      // Log Redaction:</pre><h4><strong>Authentication :</strong></h4><pre><strong>驗證方式</strong></pre><pre>  1. Authenticate after Connecting to the Shell<br>    use admin<br>    db.auth(&#39;name&#39;,&#39;password&#39;)<br>  2. Authenticate when Connecting to the Shell<br>    mongo --username &#39;name&#39; --password &#39;password&#39; --authenticationDatabase admin</pre><pre>  // 這邊會考很多變形用法，多一個參數行不行，少一個參數會怎樣。<br>  // 少一行 use admin 會怎樣, 少一個 authenticationDatabase 會怎樣<br>  // 最好自己多作嘗試搞懂 </pre><pre><br><strong>Authentication 類型</strong><br>  SCRAM-SHA-1/256, X.509 =&gt; 社區版<br>    clusterAuthMode : x509, 需要TLS<br>  MongoDB-CR, 舊的方法已停用，只有在低版本相容時使用<br>  LDAP, Kerberos =&gt; 企業版<br>    LDAP 不使用admin db, 改使用$external<br>  Kerberos =&gt; 使用kinit<br>    建立user使用 $external</pre><h4><strong>Authorization :</strong></h4><pre>這邊大概是最難記的，在MongoDB裡面多建立幾次帳號/權限會懂的比較快。</pre><pre><strong><br>權限組成</strong><br>  User, Role, Roles(Built-in Roles), Resource</pre><pre><strong>User<br>  </strong>create user=&gt;userName, pwd, roles (role, db)<br>    //如果role不指定db則是當前db<br>    //roles 由 role + db(resource)<br>    //如果是$external database, 不需要密碼</pre><pre><strong>Role</strong><br><strong>  由privileges與roles(inherited)組合而成</strong></pre><pre><strong>Privilege<br>  由action與resource組合而成<br>  </strong>//resource : <strong>{db:&quot;&quot;, collection:&quot;&quot;}</strong>, &quot;&quot;代表不指定，等同所有</pre><pre><strong>Roles</strong><br><strong>  由role與db組合而成</strong></pre><pre><strong>Resource<br>  由db與privileg組合而成</strong></pre><pre><br><strong>Built-In Roles: <br>  Database User Roles</strong><br>    read, readWrite (通常指定特定的資料庫，只能連到該資料庫)<br><strong>  Database Administration Roles</strong><br>    <strong>dbOwner = dbAdmin + userAdmin + readWrite</strong><br><strong>      userAdmin : 只能管理資料庫下的使用者, 常見給DBA</strong><br><strong>      dbAdmin : 管理資料庫物件, (通常使用dbAdminAnyDatabase)</strong></pre><pre>  <strong>//以下只有admin資料庫才有<br>  Cluster Administration Roles</strong><br>    clusterAdmin, <strong>clusterManager (管理集群用)</strong>, clusterMonitor, hostManager<br><strong>  Backup and Restoration Roles</strong><br>    backup, restore<br><strong>  All-Database Roles<br>    </strong>readAnyDatabase, readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase</pre><pre><strong>  Superuser Roles</strong><br>    root : all roles<br><strong>  Internal Role</strong><br>    __system : 內部使用，全部權力，但不該開出來</pre><pre> <strong> User-defined roles</strong><br>    指定名稱，權限，或是繼承某些權限<br></pre><pre><strong>取得權限<br>  </strong>db.getUser(&quot;caspar&quot;,{ showPrivileges:1})<br>    //showPrivileges //showCredentials<br>  db.getRole( &quot;userAdminAnyDatabase&quot;, {showPrivileges:true} );<br>    //showPrivileges //showBuiltinRoles<br>  db.getRoles( { &quot;showPrivileges&quot;: true, showBuiltinRoles: true } )                                                 <br>    //showPrivileges //showBuiltinRoles</pre><pre><strong>修改權限<br>  </strong>db.updateRole()<br>  db.grantPrivilegesToRole()<br>    // role, privileges (resource, action)<br>  db.grantRolesToRole()<br>    // 把role繼承某個role, 會出現roles[], ingeritedRoles[]兩個欄位</pre><pre><strong>移除權限<br>  </strong>db.revokePrivilegesFromRole<br>    // role, privileges (resource, action)</pre><h4>Database Profiler</h4><pre>觀念簡單，常考</pre><pre>會收集正在執行的指令，包含CRUD, 管理, 維護等語法，並且結果存在 <strong>system.profile</strong></pre><pre>預設是關閉收集不紀錄<br>  // setProfilingLevel (0) : 不紀錄<br>收集紀錄超過slowms的指令<br>  // setProfilingLevel (1) : slowms預設100<br>    // setProfilingLevel(1, { slowms: 20 }) : 指定slowms 20<br>收集紀錄全部指令<br>  // setProfilingLevel (2)</pre><h4>Log Management:</h4><pre>日誌管理相關資訊，有空加減看一下</pre><pre><strong>日誌讀取</strong><br>  方法一：db.adminCommand({ &quot;getLog&quot;: &quot;global&quot; })<br>  方法二：tail -f /data/db/mongod.log</pre><pre><strong>設定日誌等級<br>  </strong>db.setLogLevel(0, &quot;index&quot;)<br>    //從-1~5, 0是預設, 1~5是debug<br>  db.setLogLevel(-1, &quot;query&quot;)<br>    //可以看到query log, 但是必需屬於slow operation<br>    //進階設定 logComponentVerbosity 調整不同參數</pre><pre><strong>日誌格式</strong><br>  &quot;t&quot;: &lt;Datetime&gt;, <em>// timestamp<br>  </em>&quot;s&quot;: &lt;String&gt;, <em>// severity<br>  </em>&quot;c&quot;: &lt;String&gt;, <em>// component<br>  </em>&quot;ctx&quot;: &lt;String&gt;, <em>// context<br>  </em>&quot;id&quot;: &lt;String&gt;, <em>// unique identifier<br>  </em>&quot;msg&quot;: &lt;String&gt;, <em>// message body<br>  </em>&quot;attr&quot;: &lt;Object&gt; <em>// additional attributes (optional)<br>  </em>&quot;tags&quot;: &lt;Array of strings&gt; <em>// tags (optional)<br>  </em>&quot;truncated&quot;: &lt;Object&gt; <em>// truncation info (if truncated)<br>  </em>&quot;size&quot;: &lt;Integer&gt; <em>// original size of entry (if truncated)</em></pre><pre>Context:<br>  String representing the name of the thread issuing the log statement.<br>Severity:<br>  F Fetal, E Error, W warning, I info, D1~D5 debug<br>Components:<br>  ACCESS, COMMAND, CONTROL, FTDC, INDEX, QUERY, UPDATE, WRITE, NETWORK …</pre><h4>Diagnostics and Debugging</h4><pre>//查詢資料庫現狀 - Long-running operations<br>  db.currentOp()</pre><pre>//刪除特定op_id<br>  db.killOp()</pre><pre>//提供給mongodb support 處理 issue<br>  diagnostic.data</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fc53196eea6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB Certification Study Guide]]></title>
            <link>https://askstw.medium.com/mongodb-study-guide-mongodb-%E5%82%99%E8%80%83-%E8%A6%81%E9%BB%9E-%E4%B8%8A-6cd3259a6bbf?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cd3259a6bbf</guid>
            <category><![CDATA[mongodb-study-guide]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[monogodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-certified]]></category>
            <category><![CDATA[mongodb-taiwan]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Thu, 18 Mar 2021 04:25:18 GMT</pubDate>
            <atom:updated>2021-05-07T02:40:37.196Z</atom:updated>
            <content:encoded><![CDATA[<h3>MongoDB Certification Study Guide / MongoDB 證照考試指南 重點整理（上）</h3><blockquote>本文是 MongoDB Certified Study Guide（上），主要分享認證考試重點，幫助大家快速應試考取證照。</blockquote><blockquote>由於內容較多，本篇僅介紹 Philosophy and Features, CRUD, Indexes 與 Aggregation (Developer Only)。</blockquote><blockquote>其餘的包括 Replication, Sharding, Application &amp; Server Administration (DBA Only), Storage Engine, Glossary 請參考<a href="https://askstw.medium.com/mongodb-certification-study-guide-1fc53196eea6">下篇</a>。</blockquote><blockquote>MongoDB Certified Intro 請參考<a href="https://askstw.medium.com/mongodb-certification-intro-mongodb-%E8%AA%8D%E8%AD%89%E6%8C%87%E5%8D%97-57c3653d0b1b">於此</a>。</blockquote><blockquote>MongoDB Certified Overview 請參考<a href="https://askstw.medium.com/mongodb-certification-overview-448718bec20e">於此</a>。</blockquote><h4>開始之前</h4><p><a href="https://university.mongodb.com/dashboard/exams">Practice Exams</a> 記得多做，可以幫助你大致了解考試題型以及比較不足的地方，也比較好做針對性的補強。</p><h4>記得準備 <a href="https://university.mongodb.com/exam/guide">Certification Study Guide</a></h4><p>接下來會帶著大家複習考試要點，這是我在準備認證的時候整理的Study Guide，會從中挑出比較重要的部分跟大家做分享。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*p_lw0EbpPwKDNBcFjqkatg@2x.jpeg" /></figure><h3>Philosophy and Features</h3><p><strong>概述</strong></p><pre>大概會出4題, 主要都是基本知識與名詞解釋，練習題多做幾遍就差不多了。</pre><p><strong>BSON與JSON :</strong></p><pre>BSON 是Binary JSON, 可以處理更多資料型態如32-bit integer, 64-bit integer, Decimal128, timestamp。</pre><p><strong>_id (ObjectID) :</strong></p><pre>自動產生，新增空白文檔也會有ObjectID的存在<br>  values are 12 bytes in length</pre><pre>無法被更改，包含$replaceOne也無法更改。</pre><p><strong>Transaction :</strong></p><pre>MongoDB 4.0 提供 Replicaset transaction, 沒有 Sharding transaction</pre><pre>單個Transaction沒有文檔數限制，預設60秒時間，超時Transaction自動還原<br>  transactionLifetimeLimitSeconds : 60s for default have lifetime</pre><p><strong>Cursor :</strong></p><pre>cursor.maxTimeMS(ms) =&gt; process time limit, no default</pre><pre>cursor.noCursorTimeout() =&gt; idle time limit, default 10 minutes</pre><pre>cursor.batchSize=&gt; 查詢一次性回傳的筆數, default on mongo shell is 20, <br>  超過20筆資料 需使用 getMore (it) 指令iterate</pre><h3>CRUD</h3><p><strong>概述</strong></p><pre>大概會出10題, 請務必熟悉 db.collection.find() 等語法與格式<br>  考題主要是給你看一段語法，讓你判斷結果會是什麼<br>    例如: db.people.find(...)<br>    或是: db.people.updateMany(...)<br>  以下是個人整理出常見的 statement 與 operator 提供參考</pre><h4><strong>Statement :</strong></h4><pre><strong>find</strong><br>  回傳為cursor, 指定 projection { year: 1 } 例如以下<br>    db.movies.find( { genre: &quot;Action&quot; }, { year: 1 } )<br>      {_id: 0, year: 1} 才不會回傳_id值</pre><pre><strong>findOne</strong><br>  回傳為document, 預設回傳未排序的第一筆資料, 等同 sort( { $natural:1 } )</pre><pre><strong>updateOne &amp; replaceOne</strong><br>  update : 更改指定欄位<br>  replace : 替換整個文檔</pre><pre><strong>insertMany &amp; bulkWrite</strong><br>  預設是 ordered，順序匯入，stop on error<br>  使用 unordered，平行匯入，error的跳過，其他繼續</pre><h4><strong>Operator :</strong></h4><pre><strong>Comparison</strong><br>  $eq, $gt, $gte, $lt, $lte</pre><pre><strong>Logical</strong><br>  $and, $or</pre><pre><strong>Element</strong><br>  $exists, 判斷是否存在, null value也算存在</pre><pre><strong>Evaluation</strong><br>  $regex, 正則判斷<br>    start with a : /^a/, /^a.*/<br>    end with 789 : /789$/, /.*789$/<br>    case insensitive ABC : /^ABC/i<br>  <br>  $text, 查詢的時候只要有出現過都會被查詢到<br>    { $search : &quot;fact find&quot; }, fact or find 出現都算<br>  <br>  $near, geo使用, 知道就好</pre><pre><strong>Update</strong><br>  $inc<br>  $set, 修改欄位值，如果欄位不存在則新增<br>  $unset, 移除欄位職，如果欄位不存在則什麼都不做<br>  $mul, 需注意不同的數字型態相乘會有不同的結果<br>    例如 Mul NumberLong(10) by NumberInt(5) = NumberLong(50)</pre><h4><strong>Operator for array :</strong></h4><pre><strong>Query</strong><br>  [array.$], 對矩陣任何一個位置指定查詢<br>  [array.1], 對矩陣第二個位置指定查詢<br>  <br>  $all 矩陣的內容都要符合. and的意思<br>    { tags: { $all: [ &quot;ssl&quot; , &quot;security&quot; ] } }<br>    等同於 { $and: [ { tags: &quot;ssl&quot; }, { tags: &quot;security&quot; } ] }<br>  $elemMatch : 跟all類似，但有更多表示方式 例如 大於80 小於85<br>  $in : 矩陣的內容部分符合. or的意思<br>  $size : 矩陣大小</pre><pre><strong>Update</strong><br>  $push : 將值新增至矩陣<br>  $pull : 將值從矩陣移除<br>  $addtoSet : 新增至矩陣,如果值已存在矩陣則不動作</pre><h4><strong>Cursor :</strong></h4><pre><strong>skip() &amp; limit()</strong><br>  $skip 10 + $limit 5 改成成 $limit 15 + $skip 10 效能會比較好</pre><pre><strong>sort()</strong><br>  預設為1, 從小到大<br>  排序規則先data type,然後value<br>    type : null first, array last</pre><h3>INDEX</h3><p><strong>概述</strong></p><pre>大概會出8題, 主要考index的運作原理，使用index的優缺點<br>  查詢是否能用到index, 如何確認使否使用到index? (explain的內容是什麼)<br>    Compound Indexes大概是最常考的, 欄位排序與正向反向<br>    以及確保ESR Rule, 避免sort in memory<br>  最後就是index的種類與進階用法，可以大概參考以下分享</pre><h4>Index basics :</h4><pre><strong>Intro : </strong><br>  佔用硬碟/記憶體空間，讓寫入速度變慢，查詢速度提高<br>  建立index的開始與最後會對collection有短暫的exclusive lock</pre><pre><strong>Index type</strong> : B+ Tree (B Tree)</pre><pre><strong>Default Index</strong> : _id, Unique</pre><pre><strong>指定使用 Index</strong> : db.find().hint({name:1})</pre><h4><strong>Index rules :</strong></h4><pre>ESR Rule (Equaluty, Sort and Range)<br>查詢的時候，查詢條件符合ESR順序會讓查詢效果最好 (完全使用到Index)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*WfPgBOAUCKxtvK-zceWvTw.png" /></figure><h4><strong>Covered Quiries :</strong></h4><pre>能夠用最快的方式查詢資料，限定查詢時只project有在index裡面資料</pre><pre>現有index : { rating: 1, price: 1 }</pre><pre>查詢語法 : db.products.find( { &quot;rating&quot;: { &quot;$gt&quot;: 7 } }, { &quot;_id&quot;: 0, &quot;price&quot;: 1 } )</pre><pre><strong>不支援Array&amp;Embedded!!!</strong></pre><h4><strong>Cursor Explain :</strong></h4><pre><strong>queryPlanner</strong> (default)<br>  顯示 winningPlan / rejectedPlans</pre><pre><strong>executionStats<br>  </strong>呈現執行狀況, totalDocsExamined / totalKeysExamined/ nReturned/ executionTimeMillis</pre><pre><strong>allPlansExecution<br>  </strong>顯示部分拒絕的plan</pre><h4><strong>Indexes :</strong></h4><pre><strong>Single Field Indexes</strong><br>  index : { &quot;item&quot;: 1}</pre><pre><strong>Compound Indexes</strong>, 前後順序很重要, order也很重要<br>  index : { &quot;item&quot;: 1, &quot;location&quot;: 1, &quot;stock&quot;: 1 }<br>    對於查詢 { item: 1 } 或是 { item: 1, location: 1 } 都有幫助<br>    對於查詢 { location: 1, item: 1 } 或是 { item: -1, location: 1 } 沒有幫助</pre><pre><strong>Multikey Indexes</strong>, 可以對Array建立Index, 一次最多一個Array Filed<br>  一個Array有四個值，就會建立四組索引</pre><pre><strong>Geospatial Indexes</strong></pre><pre><strong>Text Indexes</strong>, 查詢時大小寫不分<br>  createIndex( { comments: &quot;text&quot; } )</pre><pre><strong>Wildcard Indexes</strong><br>  createIndex( { &quot;$**&quot; : 1 } ), 只能為Single Field, 單欄位</pre><pre><strong>Hashed Indexes</strong><br>  createIndex( { &quot;filed&quot;: &quot;hashed&quot; } )</pre><h4>Indexes Properties :</h4><pre><strong>TTL</strong>, 只能在 Single Field Indexes 生效<br>  createIndex( { &quot;ModifiedDate&quot;: 1 }, { expireAfterSeconds: 60 } )<br>    當TTL建立後就會開始刪除過期資料，注意是每60秒背景刪除, 所以資料有可能留存一小段時間直到刪除完成</pre><pre><strong>Unique</strong>, 可以在 Compound indexes 生效<br>  createIndex( pid, { unique: true } )<br>    如果要在分片中使用，index prefix 必需包含 shard key</pre><pre><strong>Collation</strong>, 可以建立 case insensitive index<br>  createIndex( { type: 1}, { collation: { locale: &#39;en&#39;, strength: 2 } } )<br>    查詢時亦要指定collation, 以指定的collation判斷回傳結果<br>      find( { type: &quot;apple&quot; } ).collation( { locale: &#39;en&#39;, strength: 2 } )</pre><pre><strong>Partial</strong>, 不能建立在_id或是shard key<br>  createIndex( { cuisine: 1 }, { partialFilterExpression: { rating: { $gt: 5 } } } )<br>    查詢條件必須與index一樣,<br>      find( { cuisine: &quot;Italian&quot;, rating: { $gte: 8 } } )</pre><pre><strong>Sparse</strong>, 只會對有field欄位的record建立索引, null value也會建立<br>  建議使用partial代替sparse</pre><pre><strong>Hidden</strong>, 不會被query planner看到, 所以不會幫助查詢, 亦無法使用 hint()指定<br>  透過 hideIndex / unhideIndex 來實現<br>  如果hidden index 有 unique / TTL 屬性, 此類功能依然生效</pre><h3>Aggregation (Developer Only)</h3><p><strong>概述</strong></p><pre>大概會出10題, 主要考法類似CRUD, 一樣給你看一段語法，讓你判斷結果會是什麼<br>  但由於aggregation語法較為複雜, stage 與 operator 種類繁多, 常常會看很久<br>需要花點心思熟悉格式, 至少可以一眼就可以看懂下列的語法, 避免考試時間不夠<br>  所以最常見的 $match, $group, $unwind 請務必熟悉<br>這段也是Developer認證中最容易落馬的部分</pre><pre>//訂單的金額按照客戶id做加總<br>db.orders.aggregate([<br>  { $match: { status: &quot;A&quot; } },<br>  { $group: { _id: &quot;$cust_id&quot;, total: { $sum: &quot;$amount&quot; } } }<br>])</pre><pre>//找出人口加總過千萬<br>db.zipcodes.aggregate( [<br>  { $group: { _id: &quot;$state&quot;, totalPop: { $sum: &quot;$pop&quot; } } },<br>  { $match: { totalPop: { $gte: 10*1000*1000 } } }<br>] )</pre><pre>//找出排名前五的likes, 先做拆分, 再分組把次數做加總, 再排序, 再找出Top5<br>db.users.aggregate([<br>  { $unwind : &quot;$likes&quot; },<br>  { $group : { _id : &quot;$likes&quot; , number : { $sum : 1 } } },<br>  { $sort : { number : -1 } },<br>  { $limit : 5 }<br>])</pre><p><strong>Aggregation basic :</strong></p><pre>限制：單個aggregation 只能有 100MB記憶體使用量 或是設定allowDiskUse</pre><pre>只出現一次<br>  $out, $merge, and $geoNear</pre><pre>只在 last stage 出現<br>  $out, $merge</pre><pre>只在 first stage 出現<br>  $collStats / $indexStat</pre><pre>只在 Primary Shard 執行<br>  $out, $lookup / $graphlookup, $facet<br>    其餘的例如$group 會在random shard</pre><pre>單一的aggregation<br>  count(), estimatedDocumentCount(), distinct()</pre><p><strong>Operators for stages :</strong></p><pre><strong>$match, </strong>裡面只能下query，如同find()<br>  基本上find()裡面有的參數也都能夠運用, 例如hint()</pre><pre><strong>$addFields($set)</strong>,<strong> </strong>如果Field已存在，亦可以當作$set使用</pre><pre><strong>$project/$unset</strong>, add/remove fileds, project : 0 等同 unset</pre><pre><strong>$unwind</strong>, 對embed文檔做拆分，由一筆文檔拆成多筆文檔<br>    source : insertOne({ &quot;_id&quot; : 1, &quot;item&quot; : &quot;ABC1&quot;, sizes: [ &quot;S&quot;, &quot;M&quot;, &quot;L&quot;] })<br>    operation : { $unwind : &quot;$sizes&quot; }<br>    result : { &quot;_id&quot; : 1, &quot;item&quot; : &quot;ABC1&quot;, &quot;sizes&quot; : &quot;S&quot; }, { &quot;_id&quot; : 1, &quot;item&quot; : &quot;ABC1&quot;, &quot;sizes&quot; : &quot;M&quot; }, { &quot;_id&quot; : 1, &quot;item&quot; : &quot;ABC1&quot;, &quot;sizes&quot; : &quot;L&quot; }</pre><pre><strong>$group</strong> <br>  { $sum : 1 } 代表次數加總<br>  { $sum : &quot;$amount&quot;} 代表值加總</pre><pre><strong>$lookup, </strong>只能在自己的db, 對象collection必須為unshard<br>   參考 : from, foreignField, localField, as(new field)</pre><pre><strong>$graphLookup</strong>, 只能在自己的db, 對象collection必須為unshard<br>   參考 : from, startWith, connectFromField, connectToField, maxDepth (0 to N), depthFiled (階層, long) ...</pre><pre><strong>$out</strong>, 將aggregation的結果寫入到另一個collection<br>  MongoDB 4.4開始可以在不同db, 對象必須為unshard<br>    operation : $out: { db: &quot;&lt;output-db&gt;&quot;, coll: &quot;&lt;output-collection&gt;&quot; }</pre><pre><strong>$merge</strong>, 將aggregation的結果寫入到另一個collection<br>  可以在不同db, 可以為shard collection<br>    { $merge: { into: &quot;myOutput&quot;, on: &quot;_id&quot;, whenMatched: &quot;replace&quot;, whenNotMatched: &quot;insert&quot; } }<br>  簡易替代用法<br>    { $merge: &lt;collection&gt; } // Output collection is in the same database</pre><pre><strong>$sortByCount, </strong>等同於一次進行 group + sort 兩個 stage</pre><pre><strong>$bucket</strong>, groupBy, boundaries (最少兩個數值)，將用戶用年齡區分<br>    operatioin : $bucket: { groupBy: &quot;$year_born&quot;, boundaries: [ 1980, 1990, 2000], default: &quot;other&quot;<br>    在區間以外的 都會被分到 other, 不設定default會報錯</pre><pre><strong>$facet, </strong>multiple pipeline ($bucket/$sortByCount) in one stage, 不能夠巢狀 (nest) 使用<br>    operation : $facet: { &quot;price&quot;: [ { $bucketAuto …} ], &quot;year&quot;: [ { $bucketAuto …} ] }</pre><pre><strong>$sample</strong><br>  隨機回傳指定數量3的文件, { $sample: { size: 3 } }</pre><pre><strong>$replaceRoot / $replaceWith</strong>,<strong> </strong>使用即時產生的新文檔取代舊文檔</pre><p><strong>Operator for expressions :</strong></p><pre><strong>$concat</strong>,<strong> </strong>將多字串組合成一串文字，但如果其中一個字串是null, 結果就會是null<br>    source : { &quot;_id&quot; : 1, &quot;item&quot; : &quot;ABC1&quot;, quarter: &quot;13Q1&quot;, &quot;description&quot; : &quot;product 1&quot; }<br>    operation : $concat: [ &quot;$item&quot;, &quot; - &quot;, &quot;$description&quot; ]<br>    result : { &quot;_id&quot; : 1, &quot;itemDescription&quot; : &quot;ABC1 - product 1&quot; }</pre><pre><strong>$split, </strong>將字串轉為矩陣</pre><h4>Operator for expressions for array :</h4><pre><strong>$slice</strong><br>  取矩陣第0個數字位置開始n個數值的子集合, n為正數則前向後,n為負數後向前</pre><pre><strong>$filter</strong><br>  透過條件過濾矩陣子集合,例如帶出item.price&gt;100的所有items (id, name, price)</pre><pre><strong>$arrayElemAt</strong><br>  回傳矩陣數字位置的內容值，從0開始，負數代表倒著數</pre><pre><strong>$indexOfArray</strong><br>  內容值在矩陣中的數字位置，從0開始, 可以有起訖</pre><pre><strong>$map</strong><br>  對矩陣的每個值做運算,矩陣維持不變</pre><pre><strong>$reduce</strong><br>  將矩陣消失，搭配inivalue運算後合成一個新的值</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cd3259a6bbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB Certified Overview]]></title>
            <link>https://askstw.medium.com/mongodb-certification-overview-448718bec20e?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/448718bec20e</guid>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mngodb-certified]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Tue, 02 Mar 2021 05:55:46 GMT</pubDate>
            <atom:updated>2021-03-30T02:10:07.799Z</atom:updated>
            <content:encoded><![CDATA[<h3>MongoDB Certified Overview / MongoDB 認證 流程</h3><blockquote>主要分享 MongoDB Certified 的流程與完整過程。</blockquote><blockquote>MongoDB 認證 序言 請<a href="https://askstw.medium.com/mongodb-certification-intro-mongodb-%E8%AA%8D%E8%AD%89%E6%8C%87%E5%8D%97-57c3653d0b1b">參考</a>。</blockquote><h4><strong>MongoDB 認證流程</strong></h4><blockquote><a href="https://university.mongodb.com/certification">MongoDB Professional Certification</a> 裡面已經有非常完整的認證流程，個人會依照自己的經驗挑些<em>認為</em><strong><em>重要</em></strong>的做分享</blockquote><h4><strong>1.選擇認證路徑，Developer or DBA</strong></h4><p>準備的方向會有不小的差異，Developer主要考<strong>CRUD</strong>, DBA主要考<strong>configuration</strong>，其餘則差不多。</p><p><strong>Developer</strong> — A software engineer fluent in at least one programming language and its associated MongoDB driver. An application developer has a detailed understanding of MongoDB <strong>CRUD</strong> operations, the driver API, schema design, aggregation and basic scaling.</p><p><strong>Database Administrator (DBA)</strong> — A MongoDB database administrator has in-depth knowledge of run-time <strong>configuration</strong>, processes, scaling, backup and recovery, monitoring, and performance tuning for production MongoDB instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*qbOYPgASO-Jrzm3JKTQ6kw@2x.jpeg" /></figure><h4><strong>2.報名考試</strong></h4><p><a href="https://university.mongodb.com/certification/developer/about"><strong>Developer Exam</strong></a></p><p><a href="https://university.mongodb.com/certification/dba/about"><strong>DBA Exam</strong></a></p><p>考試目前採虛擬線上的方式，基本上每個月都能考。</p><p>可以選擇最近兩到三個月內的時間，每個月內有一週左右的時間可以自由預約時間 (從早到晚) 應試。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*PS4eQ9rRNfVB6Gjc0R5_oQ@2x.jpeg" /></figure><h4><strong>3.應試準備</strong></h4><p>針對 MongoDB <strong>初心者</strong>，建議回到 <a href="https://university.mongodb.com/">MongoDB University</a> 補充基礎能量，按照推薦課程先走一遍再邁向應試準備。</p><p>如果已經有些MongoDB實務經驗，建議可以直接走 <a href="https://university.mongodb.com/certification/exam-prep">Practice Exam</a> 熟悉一下題型並試一下水溫，並且可以針對不熟悉的地方再做補強。</p><h4><strong>4.考題分布</strong></h4><p>重點來了(敲碗)，首先記得考試全數都是選擇題，單選或是多選</p><p>認證考試的 <strong>滿分600，通過490，答錯不倒扣。(複選題盡量有可能的都選，至少有答對有分。)</strong></p><p>所以理論上答對接近八成就會通過，有Practice Exam的協助實際上不難。</p><p>因為在實際的考試中，有少部分題目是跟Practice Exam完全一樣，大部分則是考題的題型非常類似，只是換個方式問問看。</p><p>所以Practice Exam非常的重要，請謹記，<strong>建議至少刷三到五次</strong>。</p><p>個人是為了求穩都刷了超過十次以上。</p><p><strong>DBA Practice Exam</strong></p><p>接下來看一下考題的分佈，首先是DBA Exam</p><p>在DBA Exam中個人覺得 <strong>Server Administration </strong>與 <strong>Application Administration </strong>是比較需要花時間讀懂並且背下相關參數與指令。</p><p>其餘的跟著題目刷一刷，大致的方向不會偏離太遠。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*0oUv7XSjIjah3BoWaCYUDA@2x.jpeg" /></figure><p><strong>Developer Practice Exam</strong></p><p>接下來是Developer Exam，個人在上一篇文章提到Developer Exam相對比較難，因為考題比較靈活，也考的比較細，所以需要特別注意一下，一不小心就會<strong>折戟沉沙</strong>。</p><p>而這邊需要注意的是，在個人應試的經驗中，Practice Exam當中的項目佔比與實際上<strong>略有出入</strong>。</p><p>在實際考試中，<strong>CRUD+INDEX+Aggregation</strong>題目的佔比<strong>接近60%</strong>。</p><p>尤其是CRUD與Aggregatio都考的很靈活，一不小心真的會跪。</p><p>考試前請注意再注意，切勿掉以輕心。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*rwsg06hzh5-EbvyMLsZCrQ@2x.jpeg" /></figure><h4><strong>5.閱讀指南</strong></h4><blockquote><a href="https://university.mongodb.com/exam/guide">MongoDB Certification Exam Study Guide</a> 提供了最完整的閱讀指南，如果在刷完題之後覺得時間充裕仍想再加強的話建議再來參考</blockquote><p>個人至少花了八～十個小時在指南的閱讀，針對性的補強以及重點的再整理 (應考相關的重點整理會在後續的文章持續分享，敬請期待….)</p><p>這邊有個小重點可以先分享，<a href="https://docs.mongodb.com/manual/reference/glossary/">MongoDB Glossary</a> 有空可以稍微讀一下，大概會有兩三道題目從裡面出，算是白送，一定要拿。</p><h4><strong>6.應試</strong></h4><p>最重要的就是考試能夠正常發揮，這裡有幾點注意事項，應該跟大多數虛擬線上考試差不多</p><p><strong>環境確認：</strong>應試過程與Practice Exam一樣是使用瀏覽器答題，可以使用翻譯網頁，但需要使用zoom與監考官連線，過程需要分享桌面並且視訊鏡頭全程開啟，<a href="https://prod.examity.com/systemcheck/check.aspx"><strong>環境確認請點我</strong></a>。</p><p><strong>身份文件：</strong>應試時監考官會需要出示個人的身份證明文件以證明是本人，最好是護照能做名字音譯對應。</p><p><strong>環境淨空：</strong>需要在一個沒有人的房間，手機靜音/關機，桌面淨空，不能有紙或筆或任何的東西，監考會透過鏡頭持續監控整個考試過程。</p><h4><strong>7.成績</strong></h4><p>考試答案送出的當下會收到一封信，內容寫著 <strong>MongoDB Certification Exam Results</strong>，收到這封信的時候切勿驚慌，這封信只是說您提交了考試的答案，但是成績還不會那麼快公布。</p><p>一般而言成績會在3~7個天透過Email寄發，過兩天在注意一下信件就好了。</p><p>最後祝大家考試順利，收穫滿滿！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*MxtIhV5CzYZWdlnA_yGPHg@2x.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=448718bec20e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB Certified Intro]]></title>
            <link>https://askstw.medium.com/mongodb-certification-intro-mongodb-%E8%AA%8D%E8%AD%89%E6%8C%87%E5%8D%97-57c3653d0b1b?source=rss-e81be14566dc------2</link>
            <guid isPermaLink="false">https://medium.com/p/57c3653d0b1b</guid>
            <category><![CDATA[mongodb-user-group-tw]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[mongodb-certified]]></category>
            <category><![CDATA[mongodb-taiwan]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Caspar Chang]]></dc:creator>
            <pubDate>Mon, 01 Mar 2021 03:08:12 GMT</pubDate>
            <atom:updated>2021-03-30T02:07:07.665Z</atom:updated>
            <content:encoded><![CDATA[<h3>MongoDB Certified Intro / MongoDB 認證 序言</h3><blockquote>主要分享 MongoDB University 與 MongoDB Certified 基本知識，希望讓更多人可以了解與學習MongoDB。</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTy32N5Vy4gZxzM5_VUBXw@2x.jpeg" /><figcaption>MongoDB大學提供了完整的MongoDB教育訓練與專業認證服務</figcaption></figure><h3>MongoDB線上課程</h3><blockquote><a href="https://university.mongodb.com/">MongoDB University</a> 是MongoDB官方提供的免費線上課程，能夠一步一步的了解MongoDB並熟悉使用成為專家，內容非常的充實而且淺顯易懂。</blockquote><p>課程內容適用於對資料庫尤其是NoSQL沒有經驗的Developer/DBA打基礎。</p><p>內含完整的 Learning Path 讓不管是 Developer 還是 DBA 都可以循序漸進的逐漸熟悉上手，並且在課程中有許多的 Hands on Lab 會讓學習印象更深刻。</p><p>至於學習的過程可以按照建議的Learning Path，亦可以自行選擇喜歡的課程做專業知識的補強。</p><p>現行University主要提供兩種Learning Path，而<strong>專業認證</strong>的基礎也是來自於這兩種Learning Path.</p><p><strong>MongoDB Developer Courses</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*6ETRkkQKWcBkXZ_C0WRFrA.png" /><figcaption>主要學習重點在於Aggregation與Schema Design</figcaption></figure><p><strong>MongoDB Database Administrator Courses</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*pncSACL1EG1DQlblek89Cg.png" /><figcaption>主要學習重點在於Security與Diagnostic</figcaption></figure><h3>MongoDB專業認證</h3><blockquote><a href="https://university.mongodb.com/certification">MongoDB Professional Certification</a> 提供付費的專業認證，透過線上認證確保個人的MongoDB專業能力，並且進一步協助團隊在MongoDB的專案不管是開發與維運上都能取得更好的效益。</blockquote><p>如果已經對於MongoDB已經較為熟悉，並且想要取得MongoDB專業證書，MongoDB目前有兩種專業認證，分別是Developer與DBA。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*xLtJ-IB2My9GBMuWGWDn5A.png" /></figure><p><a href="https://university.mongodb.com/certification/DEVELOPER/about">C100DEV: MongoDB Certified Developer, Associate Level</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*0shv2E_gwV5rpE-eruldEA.png" /></figure><p><a href="https://university.mongodb.com/certification/DBA/about">C100DBA: MongoDB Certified DBA, Associate Level</a></p><p>首先，證書的選擇可以依照自己的專長以及職業生涯規劃做選擇。</p><p>但如果想要同時考到兩張證照，從個人的經驗來說先後順序會很重要，會影響應試的自信心XD。</p><p>所以，對於程式開發者或是有使用過MongoDB (尤其是Aggregation)經驗的人，能夠靈活運用，選擇 <a href="https://university.mongodb.com/certification/DEVELOPER/about">Certified Developer</a> 會比較容易。</p><p>但是如果是對於MongoDB才正開始，想要學習並且考取證照，準備 <a href="https://university.mongodb.com/certification/DBA/about">Certified DBA</a> 雖然背的比較多， 但是有背就有分，會比較穩健。</p><p>至於證書準備的詳細心得會於另外的文章做分享。</p><h3>MongoDB證書查詢</h3><blockquote><a href="https://university.mongodb.com/certified_professional_finder/">MongoDB Certified Professional Finder</a> 可以搜尋到世界各地的MongoDB Certified Professionals</blockquote><p>最後，順利通過的Professional 記得要將自己的資訊登錄在此，登錄完記得來看看自己是不是有被列在名單之上了吧XD。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4quWERoE53iiwyzNfUj1FQ@2x.jpeg" /><figcaption>時至 2021/3/1 為止，目前台灣有7位 proffessionals 登錄</figcaption></figure><h3>MongoDB認證心得</h3><blockquote>最後關於Developer與DBA的認證心得，我會在另外的文章詳細分享，敬請期待XD。</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57c3653d0b1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>