pro-mern-stack icon indicating copy to clipboard operation
pro-mern-stack copied to clipboard

typo on tryMongo.js file on pgs 104 and 105

Open arrmixer opened this issue 7 years ago • 1 comments

The book has multiple periods on the return on two functions in the tryMongo.js file:

book has this:

function testWithPromises() {
   let db;
    MongoClient.connect('mongodb://localhost/playground').then(connection => {
        db = connection;
return db.collection('employees').....insertOne({id: 1, name: 'B. Promises'});

it should be

function testWithPromises() {
    let db;
    MongoClient.connect('mongodb://localhost/playground').then(connection => {
        db = connection;
        return db.collection('employees').insertOne({id: 1, name: 'B. Promises'});

Also same mistake in Generator function: book has this:

function testWithGenerator(){
    const co = require('co');
    co(function*() {
        const db = yield MongoClient.connect('mongodb://localhost/playground');

        const result = yield db.collection('employees').....insertOne({id: 1, name: 'C. Generator'});

it should be:

function testWithGenerator(){
    const co = require('co');
    co(function*() {
        const db = yield MongoClient.connect('mongodb://localhost/playground');

        const result = yield db.collection('employees').insertOne({id: 1, name: 'C. Generator'});

arrmixer avatar Jul 03 '17 12:07 arrmixer

I noticed the same thing and thought about creating an issue, but you beat me to it. :)

robbieprevost avatar Jul 06 '17 19:07 robbieprevost