Understanding the mongoose _id field

Introduction MongoDB is one of the most popular NoSQL databases. It stores data in the BSON format. BSON format is an extension of the JSON format that provides more data types. Have a look at the following document. 123456789{     "name" : "Rambo",     "age": 5,     "isAdopted" : false,     … Continued

How to Use Mongoose with a db

Introduction MongoDB is one of the most popular NoSQL databases. It stores data in BSON format (an extension of JSON). It is relatively faster than SQL databases and handles unstructured data very efficiently. MongoDB is often used with NodeJS. For object mapping between MongoDB and NodeJS, a library known as Mongoose is used. Mongoose is … Continued

Fetching Data from MongoDB using get in mongoose

Introduction As we all know, a database is used to store data. But it is not just that. We always don’t have static data. After setting up a database, we may need to perform many operations. We may need to add more data, or we need all the data or some data. We may also … Continued

The mongoose $in Operator

Introduction CRUD operations in mongoose are very important to understand. These operations include data retrieval, insertion, updating, and deletion. Mongoose provides several methods for such operations. All of these methods have a query and a projection part. A query specifies how the document will be filtered. Generally, it is an object. Have a look at … Continued

Use MongoDB to run JavaScript

Introduction to MongoDB and JavaScript This tutorial will explain techniques used for setting up the Mongo Shell so it can connect to MongoDB to run JavaScript code. The Mongo shell is an interactive interface that supports connecting JavaScript to MongoDB. Mongo shell can be used to perform administrative operations, including the querying and updating of … Continued

Simple Chat App using NodeJS and MongoDB Atlas Part 4

Introduction This lesson is Part 4 of the multiple-series tutorial, “Simple Chat App using NodeJS and MongoDB Atlas.” In Part 3, you learned how to code the server.js for the backend. Today’s lesson focuses on coding the index.html for the frontend. Let’s continue to use Node and MongoDB Atlas, the fully managed cloud database, to … Continued

How to Use Mongoose Validators

Introduction When working with mongoose, one of the very first steps is to define the schema. The schema defines the structure of documents and default values of the fields. But this is not enough. We need to define validations too. Without validations, any type of data can be inserted in the database and this is … Continued

How to Use Mongoose Custom Validators

Introduction Validating a schema is always recommended. Validations make the database better structured and avoid the insertion of bad data into it. Mongoose provides several built-in validators such as required, minlength, maxlength, min, and max. These built-in validators are very useful and simple to configure. But validations in mongoose are not limited only to built-in … Continued

Use Tesseract OCR to Insert MongoDB Documents

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 will demonstrate how you can use Python’s pytesseract and pymongo modules to read an image … Continued

How to use Mongoose to Update in Bulk

Introduction Of all the four CRUD operations, the update is the one that needs to be done very carefully, especially when there are bulk of documents to be updated. One single mistake can lead to serious trouble. Imagine, there are hundreds of documents in a collection and we try to update the bulk of documents … 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.