How to Use Mongoose Lean

Introduction Mongoose provides many methods for retrieving documents from a Mongoose collection. These methods include find(), findOne(), findById(), etc. The find() method is the most popular and widely used. It returns multiple documents based on the condition specified. But when there is a huge amount of documents in a collection, the find() method lacks performance. … Continued

How to Use Mongoose Populate

Introduction In real-time, there are many collections in a MongoDB database. While working with an application, we may need to link these collections. It is a bit complex task, but mongoose provides the populate() method that helps us with this. In this article, we will discuss how to use mongoose populate. Let’s jump in! Schemas … Continued

Use Tesseract OCR to Insert MongoDB Documents (Part 1)

Introduction to using Tesseract OCR to insert MongoDB documents Google’s Tesseract OCR (Optical Character Recognition) software allows you to analyze the text in an image in order to process it and render it as a string of characters. This article series will demonstrate how you can use Python’s pytesseract and pymongo modules to read an … Continued

How to CRUD MongoDB using NodeJS and SailsJS Part 2

Introduction This second part of this tutorial will go into how to utilize CRUD MongoDB using NodeJs and SailsJs for performing operations with MongoDB. The previous section of this tutorial series, part one, explained how to set up the project by installing SailsJs along with the necessary API or resource needed for the application. Prerequisites … Continued

Mongoose Delete Many by Id

Introduction The deleteMany() method is one of the most popular methods in mongoose to delete documents from a MongoDB collection. It is a very simple method. All we have to do is, just pass a query that contains condition(s) and the documents get deleted. But suppose we want to delete multiple documents by the value … Continued

How to Use the Mongoose deleteMany Method

Introduction Apart from deleteOne(), there is one another widely used method in mongoose to perform delete operation. This method is known as deleteMany(), and it is used to delete multiple documents. It is very simple and easy to use the method. In this article, we will discuss how to use the mongoose deleteMany() method to … Continued

Mongoose Sort Multiple Fields

Introduction Sorting is an important part of programming. We use sorting in development also. While working with databases, sorting is often used with data retrieval. In a MongoDB collection, there can be hundreds of documents. While using data retrieving methods, such as find(), we may wish to get them in sorted order. For example, if … Continued

Mongoose Drop Collection if Exists

Introduction Mongoose provides various methods that can be used for delete operation. We can delete a single document or multiple documents from a collection. We can also delete an entire MongoDB database or an entire collection. Deleting an entire collection should be done carefully. There can be a huge amount of data in a collection, … Continued

Mongoose findOne with Multiple Conditions

Introduction The findOne() method is one of the two popular methods that are used to retrieve data from MongoDB collections in mongoose. As the name suggests, the findOne() methods find a single document only. Usually, we provide a query to match a document. The findOne() method also works fine if an empty object is passed … Continued

Connect to Mongo using Mongoose

Introduction Mongoose is used to manage the relationship among data. It is an object-oriented model for Nodejs and MongoDB. It also provides schema validation. But before we can do anything with data, we need to connect to MongoDB. It is fairly easy with mongoose. In this article, we will discuss how to connect to Mongo … 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.