Beginners guide to installing and setting up MongoDB and GUI for MongoDB in Windows Machine
databases , MongoDB , Uncategorized / September 26, 2019

This is a step by step tutorial for installing MongoDB and setting up a GUI for MongoDB on Windows OS   Step – 1 Check whether MongoDB is already installed in the system To check whether MongoDB is already installed in the system, and the PATH variable is configured, use the following command. This will output the version of MongoDB .

The following command will output the Mongo shell version

If installed and configured, the output will be something like db version v3.4.14 –          mongod -version MongoDB shell version v3.4.14 –           mongo -version If not, the output will be like     Step – 2 Download and install  MongoDB and the mongo shell on Windows machine Go to the MongoDB official site and download the setup file for Mongo and install it on the machine. The default installation folder will be inside program files in your C drive

You can customize your installation and also choose whether to install or not install the MongoDB Compass which is an intuitive GUI by MongoDB Inc. Navigating to the bin folder and running the commands in Step 1 will give you the versions…

Promise.prototype.then() : JavaScript then() method and how to use it
Javascript , Requests , Uncategorized / September 25, 2019

Q:  How to use then() and how to return a promise from a function and use then() ?   A: then() is a method in the Promise prototype that returns a promise and accepts two callback functions. One function is for the success and the other is for the failure case of the promise. If both arguments are not given or are not callback functions, still then the method would not generate any errors. For example, here we create a new promise.

promise .then() exists hence it is a promise. .then() allows method chaining.   Now we will see how to use then to return a promise It is incorrect to use then() this way as it should return inside the then also. Otherwise resolving the promise returned by then will give undefined.

    It is incorrect to use the function without returning the promise returned  by then()

    Returning the promise returned by then is the correct way of returning a promise from a function

    If there is some kind of logic to be applied, this is the correct way of using then()

 

Node.js – tools/packages/practices for building a secure,high performance API with quality code

Contents >Code standard and styling >Security >Performance         In this article, we will take a look at some important aspects to be considered while developing Node.js applications and the tools/packages/practices that can be used to achieve them. Understanding and using these will help you in building a secure web application that is well structured and well documented and has a very high performance. Code standard and styling Tool – Linters(ESLint/JSLint/TSLint) Linters are static code analyzing tools that check for static code issues like styling errors, poorly structured code and unsafe code. Linters help in implementing a certain set of coding rules and helps in avoiding static errors like an absence of strict type checking, mismatched import or undefined variable usage .Static code analysis is analyzing the code for errors/faults in coding rule implementation before running the code. Dynamic code analysis is performed after the running. The most commonly used styling modules are Airbnb/JavaScript and Github/JavaScript.You have to integrate the linting plugin to the editor you are using(eg – Visual Studio Code/Sublime text). The linter will show linting errors like the following.   ESLint and JSLint are used along with JavaScript. TSLint is used with TypeScript. An example…

Share this page in social media platforms