PageSourceSearch

https://masteringjs.io/ebooks/mastering-mongoose

html masteringjs.io collected 2026-09-29 19:54:38 UTC 14,508 bytes, 358 lines download raw bytes

1
2<!DOCTYPE html>
3<html lang="en">
4  <head>
5    <title>Mastering Mongoose</title>
6
7    <meta name="description" content="The official Mongoose eBook for developers who need to become Mongoose experts fast.">
8    <link rel="stylesheet" href="/assets/style.css" />
9    <link rel="stylesheet" href="/assets/ebook.css" />
10    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700|Inconsolata:400,700" rel="stylesheet">
11    <meta name="viewport" content="width=device-width, initial-scale=1.0001, minimum-scale=1.0001, maximum-scale=1.0001, user-scalable=no">
12    <meta name="twitter:card" content="summary_large_image"></meta>
13    <meta name="twitter:title" content="Mastering Mongoose"></meta>
14    <meta name="twitter:description" content="The official Mongoose eBook for developers who need to become Mongoose experts fast."></meta>
15    <meta name="twitter:image" content="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg" />
16    <meta property="og:image" content="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg" />
17  
18    
18<script src="https://js.stripe.com/v3/"></script>
18
19    
19<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
19
20  </head>
21
22  <body>
23    
24<div class="nav">
25  <div class="branding">
26    <div class="logo">
27      <img src="/assets/logo.svg" alt="Mastering JS Logo">
28    </div>
29    <div class="name">
30      <a href="/">Mastering JS</a>
31    </div>
32    <div class="links">
33      <a href="/all">Tutorials</a>
34      <a href="https://www.getrevue.co/profile/masteringjs">Newsletter</a>
35      <a href="/ebooks/mastering-mongoose">eBooks</a>
36      <a href="/jobs">Jobs</a>
37    </div>
38    <div style="clear: both"></div>
39  </div>
40</div>
41<label class="hamburger-menu" for="burger-check">
42  &#x2630;
43</label>
44<input id="burger-check" class="burger-check" type="checkbox" style="display: none" />
45<div class="links-mobile">
46  <a href="/all">Tutorials</a>
47  <a href="https://www.getrevue.co/profile/masteringjs">Newsletter</a>
48  <a href="/ebooks/mastering-mongoose">eBooks</a>
49  <a href="/jobs">Jobs</a>
50</div>
51
52    <div class="sticky-promo">
53      <div class="cover">
54        <img src="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg">
55      </div>
56      <div class="cta">
57        <a href="#purchase">
58          <h3>I'm in! &#x21B4;</h3>
59          <div>Go to buying options</div>
60        </a>
61      </div>
62    </div>
63    <div class="sticky-promo-mobile">
64      <a href="#purchase">
65        <img src="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg">
66        <div>Buying Options &#x21B4;</div>
67      </a>
68    </div>
69    <div class="hero">
70      <div class="overview">
71        <h1>Become a Full-Stack Mongoose Expert</h1>
72        <div class="tagline">
73          The complete guide to building and maintaining <b>fast, production-ready</b> apps with Mongoose, written by <b>Mongoose's Lead Developer</b>.
74        </div>
75        <div class="cta">
76          <a href="#purchase">
77            <button class="buy">
78              Buy the eBook
79            </button>
80          </a>
81          <br>
82          <a href="https://masteringmongoose.com">
83            <button class="preview">
84              Preview
85            </button>
86          </a>
87        </div>
88
89        <div class="cover-mobile">
90          <img src="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg">
91        </div>
92      </div>
93      <div class="cover">
94        <img src="https://mastering-mongoose.netlify.app/images/mastering-mongoose.jpg">
95      </div>
96      <div style="clear: both"></div>
97    </div>
98    <div class="section">
99      <h2>Full-Stack Node.js and MongoDB, Explained</h2>
100      <p>
101        Let's face it, building APIs can be a real pain in the backend.
102        You as an API architect are responsible for shipping new features
103        while maintaining data integrity, security, developer experience,
104        and performance. Imagine yourself being confident you can
105        deliver all this and more.
106      </p>
107      <p>
108        <a href="https://mongoosejs.com/">Mongoose</a> is the most
109        popular Node.js database framework. Over 1 million GitHub projects
110        depend on Mongoose, ranging from student projects to startups
111        to Fortune 500 companies.
112      </p>
113      <p>
114        <i>Mastering Mongoose</i> will teach you the guiding principles
115        for building <b>production-ready</b> APIs and backend services
116        with Node.js and MongoDB. You'll learn:
117      </p>
118      <ul>
119        <li>
120          The relationships between the 5 fundamental Mongoose classes: Model,
121          Document, Schema, Connection, and Query
122        </li>
123        <li>
124          The 3 schema design principles for ensuring consistent performance
125          as your collections grow beyond 100k documents
126        </li>
127        <li>
128          The 4 different types of Mongoose middleware, and how to use them
129        </li>
130        <li>
131          How to integrate Mongoose with Express to build HTTP APIs
132        </li>
133        <li>
134          How to integrate Mongoose with Websockets to build realtime apps
135        </li>
136      </ul>
137      <p>
138        <i>Mastering Mongoose</i> packs all this and more into a concise 153
139        pages. That means you can become a Mongoose expert in days, not months.
140        Stop copy/pasting snippets from StackOverflow and become the backend
141        expert your team relies on.
142      </p>
143    </div>
144    <div class="section author">
145      <h2>Meet the Author: Valeri Karpov</h2>
146      <div class="author-pic">
147        <img src="/assets/images/val.jpg" />
148      </div>
149      <div class="author-bio">
150        <p>
151          Hi, I'm Val. I'm a full stack JavaScript developer based in Miami, FL.
152          I've been the maintainer of Mongoose since April 2014, and I've
153          been building apps using Mongoose since 2012. 
154        </p>
155        <p>
156          In <i>Mastering Mongoose</i>, I've distilled 8 years of experience
157          building Mongoose apps into a few hours of reading. This eBook isn't
158          a full Mongoose reference. It's a carefully curated guide explaining
159          the lessons I've learned building Mongoose apps with dozens of contributors
160          and hundreds of millions of documents.
161        </p>
162        <p>
163          I'm the author of <a href="https://asyncawait.net/"><i>Mastering Async/Await</i></a>,
164          <a href="http://es2015generators.com/"><i>The 80/20 Guide to ES2015 Generators</i></a>,
165          and <a href="https://www.amazon.com/Professional-AngularJS-Valeri-Karpov/dp/1118832078/ref=sr_1_1?ie=UTF8&qid=1528769632&sr=8-1&keywords=professional+angularjs"><i>Professional AngularJS</i></a>.
166          I've also written dozens of Mongoose tutorials on <a href="https://thecodebarbarian.com/tag/mongodb.html">my blog</a>. 
167        </p>
168      </div>
169      <div style="clear: both"></div>
170    </div>
171    <div class="section">
172      <h2>Sample Apps</h2>
173      <p>
174        <i>Mastering Mongoose</i> comes with 4 sample apps built to demonstrate
175        the eBook's lessons. These apps include:
176      </p>
177      <div class="sample-app">
178        <h3>Realtime Websocket Chat</h3>
179        <div class="app-preview">
180          <img src="/assets/images/ebooks/websocket-chat.png">
181        </div>
182        <div class="description">
183          <p>
184            A chat app built with vanilla JS on the frontend. Chat
185            messages are sent in realtime using websockets.
186          </p>
187          <p>
188            The backend is powered by Express and <a href="https://www.npmjs.com/package/ws">ws</a>.
189            The app demonstrates how to use the same port for both HTTP
190            and websockets, as well as how to integrate Mongoose with
191            websockets.
192          </p>
193        </div>
194        <div style="clear: both"></div>
195      </div>
196      <div class="sample-app">
197        <h3>React Shopping Cart</h3>
198        <div class="app-preview">
199          <img src="/assets/images/ebooks/react-music-shop.png">
200        </div>
201        <div class="description">
202          <p>
203            A sample music shop built with React. Includes test payment
204            integration with <a href="https://stripe.com/>Stripe</a>
205            and end-to-end tests powered by <a href="http://thecodebarbarian.com/control-chrome-from-node-js-with-puppeteer.html">Puppeteer</a>.
206          </p>
207          <p>
208            The backend is built with Express. This app demonstrates
209            how to manage a shopping cart with Express and Mongoose,
210            including how to check out with Stripe.
211          </p>
212        </div>
213        <div style="clear: both"></div>
214      </div>
215      <div class="sample-app">
216        <h3>Vue Stock Portfolio</h3>
217        <div class="app-preview">
218          <img src="/assets/images/ebooks/vue-stock-portfolio.png">
219        </div>
220        <div class="description">
221          <p>
222            A Vue app that calculates the total value of your stock
223            portfolio. Includes server-side rendering
224            and end-to-end tests powered by <a href="http://thecodebarbarian.com/control-chrome-from-node-js-with-puppeteer.html">Puppeteer</a>.
225          </p>
226          <p>
227            The Express-based backend demonstrates how to handle
228            pre-fetching data for server-side rendering.
229          </p>
230        </div>
231        <div style="clear: both"></div>
232      </div>
233    </div>
234    <div class="section" id="purchase">
235      <h2>Buy the eBook Today</h2>
236      <div class="cover">
237        <img src="/assets/images/ebooks/mongoose-preview.jpg">
238      </div>
239      <div class="details">
240        <h3>What's Inside</h3>
241        <ul>
242          <li>PDF and ePub</li>
243          <li>Link to online HTML version</li>
244          <li>Access to sample app GitHub repo</li>
245        </ul>
246        <div class="price">
247          <b>$39.99</b>
248        </div>
249        <div class="paypal-button buy" style="cursor: pointer" onclick="stripeCheckout()">
250          Buy Now
251        </div>
252        <div class="small">
253          Have an issue? <a href="https://github.com/vkarpov15/masteringjs.io/issues">Report it on GitHub</a> and we'll respond within 24 hours.
254        </div>
255        <div class="small">
256          Not happy with your purchase?
257          <a href="mailto:[email protected]">Email [email protected]</a> with your transaction id for a full refund.
258        </div>
259      </div>
260      <div style="clear: both"></div>
261    </div>
262
263    <link rel="stylesheet" href="/assets/footer.css" />
264    
265<footer id="footer" class="footer">
266  <div class="container">
267  <div class="group">
268      <div class="col span_1_of_3">
269      <img class="footerLogo" src="/assets/images/footer/logo.svg" alt="logo">
270      <div class="socialIcon">
271        <a href="https://twitter.com/mastering_js"><img src="/assets/images/footer/twitter.svg" alt="twitter"></a>
272        <a href="https://github.com/mastering-js/masteringjs.io"><img src="/assets/images/footer/github.svg" alt="github"></a>
273        <!-- <a href="#"><img src="/assets/images/footer/linkedin.svg" alt="linkedin"></a> -->
274      </div>
275      <div class="locationAndMail">
276        <span class="addressCtrl"><img src="/assets/images/footer/location.svg" alt="location"> <span>Miami Beach, FL</span></span>
277      </div>
278      <div class="copyRight">
279        <p class="copyRight">Copyright © <a href="https://meanitsoftware.com/">MeanIT Software, Inc.</a></p>
280      </div>
281      </div>
282      <div class="col span_2_of_3 footerLink">
283          <div class="col span_1_of_3 tutorial">
284            <h4>Tutorials</h4>
285              <ul>
286                  <li> <a href="/fundamentals">Fundamentals</a></li>
287                  <li> <a href="/node">Node</a></li>
288                  <li> <a href="/vue">Vue</a></li>
289                  <li> <a href="/webpack">Webpack</a></li>
290                  <li> <a href="/axios">Axios</a></li>
291                  <li> <a href="/mongoose">Mongoose</a></li>
292                  <li> <a href="/express">Express</a></li>
293                  <li> <a href="/lodash">Lodash</a></li>
294                  <li> <a href="/npm">npm</a></li>
295                  <li> <a href="/eslint">ESLint</a></li>
296                  <li> <a href="/sinon">Sinon</a></li>
297              </ul>
298              <div class="subscribe">
299                <span class="subscribeText">Subscribe to our Newsletter &rsaquo;</span> <a href="https://masteringjs.substack.com/"><button class="subscribeBtn">Subscribe</button></a>
300              </div>
301      </div>
302      <div class="col span_1_of_3">
303                  <h4>eBooks</h4>
304                  <ul>
305                      <li> <a href="/ebooks/mastering-mongoose">Mastering Mongoose</a></li>
306                  </ul>
307    </div>
308    <div class="col span_1_of_3">
309      <h4>Resources</h4>
310      <ul>
311        <li> <a href="/about">About</a></li>
312        <li> <a href="https://github.com/sponsors/mastering-js">Partnerships</a></li>
313      </ul>
314    </div>
315  </div>
316  </div>
317</div>
318</div>
319</footer>
320
321
322    
322<script type="text/javascript">
323      var stripeKey = 'pk_live_51IoDkvEIfgvH77vtfJZwToZlC20FilHNRViMce42TBCeFsptEIkUcjz09MMPbfn4pU9St2nM8P9aYlL4l7q8SLbf00ivnWmIpw';
324      var stripe = Stripe(stripeKey);
325      var server = window.location.hostname === 'localhost' ?
326        'http://localhost:7071' :
327        'https://masteringjs-job-board.azurewebsites.net';
328      var status = 'init';
329
330      function stripeCheckout() {
331        if (status !== 'init') {
332          return;
333        }
334        document.querySelector('.paypal-button').innerHTML = 'Checking Out...';
335        axios.post(server + '/api/createEbookCheckout', { itemNumber: '0002' }).then(function(response) {
336          document.querySelector('.paypal-button').innerHTML = 'Buy Now';
337          status = 'paid';
338          return stripe.redirectToCheckout({ sessionId: response.data.id });
339        }).catch(() => {
340          document.querySelector('.paypal-button').innerHTML = 'Buy Now';
341          status = 'init';
342        });
343      }
344
345      window.addEventListener('scroll', function() {
346        var diff = document.querySelector('#purchase').getBoundingClientRect().top - window.innerHeight;
347
348        if (diff <= -50) {
349          document.querySelector('.sticky-promo').classList.add('hide');
350          document.querySelector('.sticky-promo-mobile').classList.add('hide');
351        } else {
352          document.querySelector('.sticky-promo').classList.remove('hide');
353          document.querySelector('.sticky-promo-mobile').classList.remove('hide');
354        }
355      });
356    </script>
356
357  </body>
358</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.