SHARE

Hey all, in this Mongodb tutorial for beginners I’ll show you how we can implement the ES6 promise library instead of using the Mongoose default one. I’ll also introduce you to mocha hooks, which we can use to fire code before our tests begin.

—– COURSE LINKS:
+ Repo – https://github.com/iamshaunjp/mongodb-playlist
+ Atom editor – https://atom.io/a
+ Download GIT – https://git-scm.com/
+ CMDER – http://cmder.net/
+ MongoDB – https://www.mongodb.com/
+ Robomongo – https://robomongo.org/

JS Playlist – https://www.youtube.com/playlist?list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET

NODEJS Playlist – https://www.youtube.com/playlist?list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp

ASYNC JS Playlist – https://www.youtube.com/playlist?list=PL4cUxeGkcC9jAhrjtZ9U93UMIhnCc44MH

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

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

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

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gnow7e45LQFkNVxwQ5BH-W

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

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp

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

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

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

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

8 COMMENTS

  1. You should also disconnect from db in after(), because Mocha 4 won't terminate the process without it 🙂

    I just wasted 2 hours -_-

  2. Hey ninja, this tutorial should be update there are some changes in mongoose, and it will not work the way it used to work and you explained…. Thank you very much

  3. before function is not working
    error : ReferenceError: before is not defined
    my code is ….

    const mongoose = require('mongoose');
    mongoose.Promise = global.Promise;

    before(function(done){

    mongoose.connect('mongodb://localhost/testaroo');
    mongoose.connection.once('open', function(){
    console.log('connection has been made successfully');
    done();
    }).on('error', function(error){
    console.log('connection has been terminated');
    });

    });

  4. Not to be too bitter… but your title is MongoDB Tutorial – ES6 Promises. Would be nice if this was about MongoDB and Promises and not Mongoose and Promises.

LEAVE A REPLY

Please enter your comment!
Please enter your name here