A short update

So last night I started reading the tutorial on The Mean and Mern stack and tried to follow along. Even though the article is only a year old, I had a lot of trouble getting their example to work because parts of it had already been outdated.

They use a Mongo Atlas database, which is a convenient way to run a database server for testing. However mongo driver they used in the example were outdated and it took me a while to figure out that was the problem. Updating it was effortless though.
I also had some problems renewing the Mockaroo link as they requested I did. Mockaroo is an online tool to create mock data for testing. I ended up just using their supplied link.

While walking through the code they used the Javascript ‘promise’ quite a lot. I struggled to understand the code that used the promise since it’s a new concept for me. In the end I looked it up and got smarter.

doSomething()
.then(result => doSomethingElse(result))
.then(newResult => doThirdThing(newResult))
.then(finalResult => {
console.log(`Got the final result: ${finalResult}`);
})
.catch(failureCallback);

I had troubles understanding where the result variable came from. It seems as it it defined and used as a variable without being set. However I see that it is like LINQ. ‘result’ is the return of the doSomething function and used as parameter to the doSomethingElse function.

Later today the Mongo University course should start, i’m looking forward to that.

Leave a Reply

Your email address will not be published. Required fields are marked *