How to Use mongoose remove

Introduction If you need to delete data from your MongoDB database, it’s important to proceed with caution. Deleting data is a permanent operation, so there’s no real margin for error. Mongoose, the Javascript framework commonly used to communicate with MongoDB from a Node.JS application, provides a number of ways to handle deletions. It offers two … Continued

The mongoose model

Introduction MongoDB is referred to as a schemaless database, meaning the number and type of columns do not need to be specified before inserting data. However, because it is schema free, MongoDB does not provide support for creating schemas, validation or abstraction. Mongoose is an Object Modeling Library, or ODM, that supports the methods and … Continued

mongoose schema types

Introduction MongoDB is a schema-less database. It is one of the reasons we use mongoose with it. Mongoose is an Object Modelling Library(ODM). Apart from providing schema, mongoose also provides Validation. Other features of mongoose are plugins, middleware, and population. MongoDB stores data in BSON. BSON in binary encoded JSON. It provides more data types … Continued

mongoose Tutorial

Introduction Mongoose is an Object Modeling Library(ODM). It is heavily used with nodejs when MongoDB is there. One main advantage is that it provides abstraction. MongoDB is schema-less but with mongoose, the developers can define a schema. It overcame the one main problem. Moreover, MongoDB methods can easily be used in mongoose. Another important feature … Continued

mongoose push

Introduction There are several data structures such as trees, graphs, arrays, stacks, etc. Arrays are one of the most commonly used data structures in the programming world. They are perfect to store values. We can store any type of data in arrays. While working with databases, we may need to store data in an array. … Continued

mongoose find one

Introduction MongoDB provides several methods to perform a Read operation on a collection. All these methods are supported by mongoose also. Some of the common methods are find(), findOne(), findOneAndUpdate(), and findOneAndDelete(). Each of these methods has unique functionality. We can use them according to our requirements. In this article, our focus is on the … Continued

mongoose findById

Introduction One of the most frequently used CRUD operations is the Read operation. Mongoose provides several methods to read the data from a database. Each method has its own specialty. We can use these methods according to our requirements. One of these methods is the findById() method. As the name suggests, the findById() method is … Continued

mongoose Query LIKE

Introduction In SQL, we have the LIKE operator that is used to match a pattern in a string. It is very useful while performing CRUD operations on a database. Unfortunately, no such operator exists in MongoDB. But it does not mean we cannot achieve the functionality of the LIKE operator in MongoDB and mongoose. In … Continued

mongoose Pagination with NodeJS and MongoDB

Pagination Pagination is a process in which a document is divided into discrete pages. In simple words, if we have a document containing a large amount of data, and we wish not to print all of it in once, we divide this data into “pages”. These pages contain data according to the limit specified. In … Continued

How to use the mongoose update query in NodeJS

Introduction Out of all the CRUD operations, the Update operation should be handled with utmost care. There could be hundreds of records in a database. One mistake and you end up updating a wrong record. This can lead to further problems. So the most important part of an Update operation is where we match the … Continued

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.