Home » MongoDB

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 »