Yo ninjas, in this final MongoDB tutorial for beginners, I’ll show you how we can nest sub-documents.

+ Repo –
+ Atom editor –
+ Download GIT –
+ MongoDB –
+ Robomongo –

JS Playlist –

NODEJS Playlist –

ASYNC JS Playlist –

You can find more front-end development tutorials on CSS, HTML, JavaScript, jQuery, WordPress, Node.js & more on the channel homepage…


========== PSD to WordPress Playlist ==========

============ Node.js for Beginners Playlist =============

============== The Net Ninja =====================

For more front-end development tutorials & to black-belt your coding skills, head over to – or

================== Social Links ==================

Twitter – @TheNetNinja –


  1. Great tutorial. Had some issues with the beforeEach being on the connection.js test, but once I moved it dropping the table seemed to work. Also you need to add {useMongoClient: true} to the mongoose.connect function like so:

    mongoose.connect('mongodb://localhost/testaroo',{useMongoClient: true});

    Also after I run npm run test my console stays active and I have to Ctrl C to quit running the test.

  2. Great job! Have no clue about programming but the desire to learn it. Tried multiple sources (paid & for free)… I am clearly sticking to your channel the most.
    If I could, I would subscribe more than ones 🙂

  3. Where do the " describe; it; beforeEach " functions come from? Is it standard js, is it added in the node maschine or is it a npm package ?
    Still very glad I found you!

  4. Once again, thank you very very very much
    I love you, and I really really thank you, from the deep of my heart.
    your are true fullstack human-angel

  5. Great series. Thanks. One question. Is there a way to define the order in which the tests run? For example saving_test.js then updating_test.js then deleting_test.js.

  6. He used "result" when asserting the length of "books" the second time around, but "record" the first time. I just tried "record" for the second, more complicated "it" thingy and it didn't give me any problems. Is there a difference between using "record" and "result"?

  7. A newbie here. I don't get why in order to prevent multiple creation of 'author OBJ' with the same name and different book, u need to 'drop' the author after each test. In fact, aren't u losing essential data if each author is unique?

    Cant u just create a conditional where (if, existing_author.books.push(bla bla) ) if u r looking to prevent duplication?

    Otherwise i learnt a lot about mongoose!


Please enter your comment!
Please enter your name here