Home » JavaScript

Tips to Add Tooltip to Select2

How to add tooltip in select2 When selected text is long in select2, then it does not show the full text. So, it is very difficult to understand what is selected. For the above problem we can solve…

Read More »

Temporal dead zone (TDZ) and the Deathly Hallows

What is TDZ in javascript? Temporal dead zone is the period between entering scope and being declared where they cannot be accessed. An example will give it clear the concept of TDZ. So, for example- accessDenied = ‘can not…

Read More »

Circular dependencies in Node.js

What is cyclic/ circulardependencies in nodeJs When required a module and we got {} instead. Suppose, we have the following code // moduleA.js var ModuleB = require(‘./moduleB.js’); var ModuleA = function() { this.bInstance = ModuleB(); this.property = 10;…

Read More »

Using Sinon to stub Mongoose calls and return Promise

Suppose we have a schema var User = require(‘./schemas/UserSchema’).User; and we want to write unit test for like bellow code: var getUserById = function () { return User.findOne({_id: ‘001’}).exec(); }; Before writing unit test we can mock the…

Read More »

Mongodb Full Text Search

MongoDB Full Text Search MondodDB full text search is used to search text content. Text Search uses Text Index and $text operator to perform its operation. Why we need Full Text Search First, we need to know why and when…

Read More »

Mongodb Map-Reduce

Mongodb Map-Reduce Map-reduce is a data processing paradigm for condensing large volumes of data into useful aggregated results. In this map-reduce operation, MongoDB applies the map phase to each input document (i.e. the documents in the collection that…

Read More »