Category: MongoDB

September 7, 2021 / MongoDB

$or operator in mongoose is used to perform a logical OR operation on an array of expressions. It helps you in situations when you need to find documents with multiple conditions. Such as creating a search with multiple parameters. It accepts an array of expressions and returns all the documents…

July 5, 2021 / MongoDB

In situations where you need to get documents excluding some specific values, as a beginner, you will extract all documents and use javascript to filter. But that’s not the ideal way to do this. MongoDB gifted us with a really powerful operator that can help us make a mongo query…

June 10, 2021 / CodeMoments

Population or Query Population in mongoose is a process of automatically replacing paths with other documents from other collections in a single document, multiple documents, objects, multiple objects. That’s the official definition of the population by a mongoose. But, most of us would understand this one: “Population is simply a…

June 4, 2021 / MongoDB

When it comes to pagination, the first solution that comes to our mind is fetching all the documents form MongoDB and then create a Javascript function to run on that data to do pagination. But there is a better way, you can use limit, sort and skip mongo function to…