
Master ES6 promises and their role in MongoDB through a browser-based HTML game that tests promise syntax. Explore setup with a code editor, an HTML file, and the browser console.
Build a vanilla es5 JavaScript game that counts button clicks over two seconds to decide win or loss. Refactor to use promises and compare promise-based flow with es5 approach.
Refactor the game into a standalone function and implement promises to handle win or loss with resolve, reject, then, and catch.
Learn how promises manage asynchronous code flow, including unresolved, resolved, and rejected states; chain then and catch, and distinguish promise creation from consumption in libraries such as jQuery and Axios.
discover where mongodb fits in a modern web stack, how a web server enforces data security, and why developers use mongoose to simplify mongo data manipulation.
Explore where Mongo fits in a modern application stack and why apps connect through a web server, using databases and collections to organize states and books.
Master core MongoDB and Mongoose concepts by practicing the four create, read, update, destroy operations—in a from-scratch project. Explore databases and collections in a MongoDB instance.
Set up a node project with npm init, install mocha, nodemon, and mongoose, wire a user collection with mongoose, and master create, read, update, and delete operations tested by mocha.
Learn to test MongoDB apps using Mongoose and Mocha, covering create, read, update, and destroy operations, plus setting up a test helper and project structure.
Connect to a local MongoDB database with mongoose by requiring the library and calling mongoose.connect to the users_test database. Listen for open and error events to confirm success or troubleshoot.
Learn how to use Mongoose to create a users collection, define a user model and schema, and generate single records while preparing tests to read, write, and update data.
Create a user model with a schema in Mongoose, automatically establishing a users collection and enabling single-user instances through the model, export it, and prepare Mocha tests.
Develop tests for a user model using Mocha by creating a test file, structuring with describe and it blocks, and writing assertions to verify inserting a record into the database.
Learn how to run mocha tests for the user model by creating a _test file to validate record creation, importing assert, and using describe and it blocks with npm test.
Create and save a new user instance using the user model in a mocha test, import the model, instantiate with a name, and verify the save to the mongo database.
Persist a new user to MongoDB with Mongoose by calling joe.save on the new user instance, and verify the result using a test suite and Robomongo.
Learn how to ensure test isolation by dropping the users collection before each test in a Mocha suite, using Mongoose to drop all records efficiently.
Leverage mocha's done callback to synchronize asynchronous database drops in beforeeach, ensuring the users collection clears before each test and enabling proper assertions in the test suite.
Write a Mocha test that saves joe to MongoDB using joe.save, waits for the promise, and asserts that joe.isNew becomes false after the save, signaling successful persistence.
Replace Mongoose's default promise library with es6 promises and ensure tests run only after a one-time before hook connects to Mongo.
Learn to read records from MongoDB with Mongoose by testing two read methods: find all users named Joe and find a user by id, using a before each setup.
Learn the id property big gotcha in mongoose and mongodb by comparing IDs with to string on both sides, and asserting that the first user's ID equals Joe's ID.
Learn to automate test runs with Nodemon, replacing Mocha’s watch, by watching the project and re-running Mocha with condensed output to keep tests up to date.
Leverage Mongoose to find a user by underscore id using findOne, compare with find, and validate the result with an assert on the user name, using done callbacks in tests.
Explore four MongoDB deletion methods using mongoose: model instance remove, model class remove, find and remove, and find by id and remove, with practical testing and promise chaining.
Explore class method remove versus model instance remove in MongoDB, and learn to chain promises to remove one user or many by criteria.
Learn four class-based removal methods in mongoose: find one and remove and find by id and remove, including removing by name or id and verifying the record no longer exists.
Explore the five ways to update records in MongoDB using Mongoose, comparing model instance updates with class-based updates, and master the set and save method.
Update records with the set and save methodology in Mongoose, updating properties in memory with set, then persisting changes to the database with save.
Explore updating a single property on a model instance, using update, set and save, and test-driven patterns to verify changes in MongoDB models.
Explore class-based updates in MongoDB, learning how to update all matching records, find one and update, and find by ID and update, with practical guidance.
Learn how to use MongoDB update operators to efficiently increment post counts across many users with class-based updates, using inc, set, and other modifiers.
Explore the increment update operator in Mongo, updating many records by incrementing a field, with tests validating post counts and noting there is no decrement operator (use negative increments).
Explore how Mongoose validates records before saving to a Mongo database, enforcing a name length rule and preventing invalid data, with tests to verify validation.
Learn how to require a username in a mongoose model by making the name field mandatory and displaying a name is required error message through synchronous validation and tests.
Enhance user schema with an advanced validator: add a validate object with a validator function and message to enforce names at least three characters.
Learn how to enforce validation by automatically preventing invalid records from saving, and handle failed saves with catch blocks to access validation errors and messages.
Embed posts in the user model to illustrate a user has many posts, using a post schema instead of a separate post model.
Learn how to nest posts within a user document by creating a post schema and embedding it as a posts array in the user schema, without a separate post model.
Explore testing subdocuments in Mongoose by creating a user with an embedded post, saving, retrieving, and asserting the post title matches, demonstrating nested docs and automatic schema application.
Learn how to add subdocuments to an existing user in MongoDB by updating the posts array and saving the entire parent document, with promise-based tests.
Learn how to remove a subdocument from a user's embedded posts in mongoose, call remove on the post, save the user, and verify the posts list is empty.
Explain how virtual types in Mongoose let post count be computed from the posts array without persisting; illustrate via a test-driven setup and a virtual type test.
Understand virtual fields with getters calculate a user’s post count by using this.posts.length in a getter function. Learn testing in a node shell and why function scope preserves instance context.
Fixes update tests by introducing a likes property, replacing post count, and using the increment operator on a number field with tests defaulting to zero, while examining virtual fields.
Examine the design challenges of nesting posts inside a user in mongoose, highlighting flatmap-like cross-user queries, finite post retrieval, and simpler access for a single user.
Explore the trade-offs between embedded documents and separate collections in MongoDB, and learn how splitting into users, posts, and comments can improve queries and scalability.
Refactor the app by introducing a separate blog post collection while keeping embedded posts on the user model and adding blog post and comment models with Mongoose schemas and references.
Wire blog posts to comments and comments to users by configuring mongoose objectId refs, illustrating the difference between subdocuments and cross-collection references.
Set up user blog post associations by adding a blog posts list to the user model with objectId and href references, and test these relationships using Mongoose.
Explore wiring up has many and has one relations with Mongoose by linking a user, blog posts, and comments using object IDs and handling associations in tests.
Learn how to save related records in parallel with Promise.all in Node.js to ensure user blog post and comment associations are saved before persisting to MongoDB.
Learn to use Mongoose queries with findOne, dot then, and the populate modifier to load a user’s blog posts. Understand why comments aren’t auto-loaded and recursive loading isn’t automatic.
Learn to load deeply nested associations with mongoose populate, retrieving a user, their blog posts, and comments. Manage performance by limiting associations and using path with nested populate.
Learn to implement middleware in Mongoose to automatically clean up a user's blog posts when the user is removed, using pre and post hooks around remove events.
Define a pre remove middleware on the user model to clean up associated blog posts. Use mongoose.model to access the blog post model without circular requires.
Implement pre-remove middleware in mongoose to delete all blog posts linked to a user using the in operator on the blog posts ID array, ensuring next completes before removal.
Explore pre-remove middleware in Mongoose to delete a user's blog posts; the test creates a user and a blog post, removes the user, and asserts the post count reaches zero.
Explore implementing pagination in mongoose using skip and limit to display a six-record window, navigate results with previous and next, and test queries with find and find one.
Apply skip and limit to a find query to paginate results in MongoDB, and test by creating four users and validating a two-record window after skipping the first.
Apply sort, skip, and limit in mongoose queries to guarantee consistent test results, sorting by name ascending and guarding against latency-induced ordering issues.
Kick off a new Star Music project by installing dependencies and starting the app, then implement the find artist query and build add, edit, and delete artist pages.
Define mongoose artist and album models with a nested albums subdocument, matching the schema fields and capitalization, using locally seeded data for artists and albums.
Define the album schema as an embedded subdocument of the artist, including title, date, copies sold, tracks, image URL, and revenue; export and link it to the artist.
Build an artist model in Mongoose with a subdocument albums array and property names, defining fields such as name, age, years active, image, genre, website, net worth, label name, retired.
Implement a find artist query that locates a single artist by ID and returns the query promise, wiring the artist model and album schema.
Learn to fetch a single artist by ID using findOne or findById in Mongoose, noting that findById behaves identically to findOne and accepts the ID as its first argument.
Implement the create artist operation by inserting a new artist document into the artists collection in MongoDB, returning a promise that resolves with the created artist.
Create artists by passing artist props, save to the artist collection with artist.save, and return the promise to navigate to the details screen during rapid testing of MongoDB inserts.
Delete a single artist from the artist collection using the delete one query, test via the details screen and random artist, and verify removal with record count or robomongo.
Delete a single artist document in MongoDB using Mongoose with a one-step artist.remove by id, and compare it to a slower two-step find by id then remove approach.
Update an artist by id and a values object, then submit to persist changes; the form passes strings and years active, defined by the Mongoose schema, converts to a number.
Learn to edit a single artist in MongoDB by updating specific fields with an ID-based query in one operation, verifying changes in the app and using ES6 shorthand for clarity.
MongoDB is the hottest database solution in the tech world right now, able to power anything from your growing personal project to an enterprise infrastructure.
NodeJS focused? Yep. Test Driven Exercises? Absolutely! Advanced Features of MongooseJS? You know it.
This course will get you up and running with MongoDB quickly, and teach you the core knowledge you need to deeply understand and build apps centered around Mongo.
We'll start by mastering the fundamentals of Mongo, including collections, validations, and common record manipulation techniques. Source code is provided for each lecture, so you will always stay up-to-date with the course pacing. Special attention has been paid to creating reusable code that you'll be able to make use of on your own fantastic projects.
If you are new to MongoDB, or if you've been working to learn it but sometimes feel like you still don't quite 'get it', this is the MongoDB course for you! To learn MongoDB you have to understand it.
I've built the course that I would have wanted to take when I was learning MongoDB. A course that explains the concepts and how they're implemented in the best order for you to learn and deeply understand them.