Mongoose Tutorial Read Courses Improve Improve Improve Like Article Like Save Article Save Report issue Report Mongoose is an Object Data Modeling (ODM) library for MongoDB. MongoDB is a NoSQL database and Mongoose is used to interact with MongoDB by providing a schema-based solution. The Mongoose acts as the abstraction layer over the MongoDB database. It is generally preferred over using normal MongoDB because it simplifies the process of sending complex queries. Why Learn Mongoose?Mongoose is used in Node application to interact with MongoDB without write complex queries. It acts as an Object Data Modeling (ODM) used to define schema model and provides easy communication between application and database. It provides many features like schema validation, middleware support, and easy query building It manages relationships between data, and is used to translate between objects in code and the representation of those objects in MongoDB. Mongoose AdvantagesSchema Definition: Mongoose allows you to define structured schema model for MongoDB collections, because of that you get a clear understanding about the structure of model data.Data Validation: It can be used for data validation, which ensures that only valid and properly formatted data is stored in the database, which helps to manage data integrity.Middleware Support: Mongoose has the support of middleware which helps in the execution of custom logic before or after database operations, that offers flexibility in handling data interactions.Query Building: We don’t have to write those complex queries which we were writing in MongoDB because Mongoose simplifies the process by providing a high-level API that makes it easier to interact with the database.Modeling Relationships and Population: You can define relationships between different data models and it also supports population, due to this you can work with related data without disturbing database normalization. Mongoose Basics:Connect Node to database using MongooseMongoose Module IntroductionMongoose ConnectionsMongoose SchematypeMongoose SchemaType OptionsMongoose Schema APIMongoose Schemas VirtualsMongoose Schemas IndexesMongoose Document APIMongoose DocumentsMongoose PluginsMongoose PopulateMongoose QueriesMongoose VirtualsCRUD Operations Using MongooseMongoose Documents vs ModelsMongoose Schemas Creating a modelMongoose ValidationAggregation in MongoDBTransactions in MongooseMongoose Functions:Mongoose Populate() methodMongoose find() FunctionMongoose where() FunctionMongoose remove() FunctionMongoose exists() FunctionMongoose update() FunctionMongoose insertMany() FunctionMongoose findById() FunctionMongoose findByIdAndDelete() FunctionMongoose findByIdAndUpdate() FunctionMongoose findByIdAndRemove() FunctionMongoose findOneAndDelete() FunctionMongoose findOneAndUpdate() FunctionMongoose findOneAndReplace() FunctionMongoose findOneAndRemove() FunctionMongoose replaceOne() FunctionMongoose updateOne() FunctionMongoose updateMany() FunctionMongoose insertMany() FunctionMongoose findOne() FunctionMongoose deleteOne() FunctionMongoose Projects:Login form using Node JS and MongoDBUpload and Retrieve Image on MongoDB using MongoosePagination on an APINodejs – Connect MongoDB with Node app using MongooseJSSignup Form Using Nodejs and MongoDBLogin form using Node.js and MongoDBConnect Django Project to MongoDB using DjangoMongoDB IntroductionHow do Document Databases Work?How MongoDB works?MongoDB: An introductionWhat is MongoDB – Working and FeaturesDifference between RDBMS and MongoDBMongoDB vs MySQLMongoDB InstallationHow to Install and Configure MongoDB in Ubuntu?How to install MongoDB on MacOS?How to install MongoDB on Windows?Basics of MongoDBMongoDB – Database, Collection, and DocumentMongoDB CursorDataTypes in MongoDBWhat is ObjectId in MongoDBWhat is a MongoDB Query?MongoDB | Create a Database using MongoShellMongoDB | Delete Database using MongoShellMongoDB CRUD operationsMongoDB MethodsMongoDB – Insert() MethodMongoDB – insertOne() MethodMongoDB – insertMany() MethodMongoDB – Bulk.insert() MethodMongoDB – bulkWrite() MethodMongoDB – Update() MethodMongoDB – updateOne() MethodMongoDB – updateMany() MethodMongoDB – Find() MethodMongoDB – FindAndModify() MethodMongoDB – sort() MethodMongoDB – copyTo() MethodMongoDB – count() MethodMongoDB – countDocuments() MethodMongoDB – drop() MethodMongoDB – Remove() MethodMongoDB – deleteOne() MethodMongoDB – getIndexes() MethodMongoDB – dropIndex() MethodMongoDB – dropIndexes() MethodMongoDB OperatorsComparison OperatorsMongoDB – Comparison Query OperatorsMongoDB $cmp OperatorMongoDB – Greater than Operator $gtMongoDB – Less than Operator $ltMongoDB – Equality Operator $eqMongoDB – Less than equals to Operator $lteMongoDB – Greater than equals to Operator $gteMongoDB – Inequality Operator $neMongoDB $in OperatorMongoDB – $nin OperatorLogical OperatorsMongoDB – Logical Query OperatorsMongoDB AND operator ( $and )MongoDB OR operator ( $or )MongoDB NOT operator ( $not )MongoDB NOR operator ( $nor )Arithmetic OperatorsMongoDB $add OperatorMongoDB $subtract OperatorMongoDB $multiply OperatorMongoDB $divide OperatorMongoDB $abs OperatorMongoDB $floor OperatorMongoDB $ceil OperatorMongoDB $mod OperatorMongoDB $sqrt OperatorMongoDB $pow OperatorMongoDB $exp OperatorMongoDB $log OperatorMongoDB $log10 OperatorMongoDB $ln OperatorField Update OperatorsMongoDB – Field Update OperatorsMongoDB – Maximum operator ( $max )MongoDB – Minimum operator ( $min )MongoDB – Increment Operator ( $inc )MongoDB – Multiply Operator ($mul)MongoDB – Rename Operator ($rename)MongoDB – Current Date Operator ($currentDate)MongoDB – SetOnInsert Operator ($setOnInsert)MongoDB Bitwise Update OperatorArray Expression OperatorsMongoDB $isArray OperatorMongoDB $size OperatorMongoDB $arrayElemAt OperatorMongoDB $concatArrays OperatorMongoDB $reverseArray OperatorArray Update OperatorsMongoDB – $pull OperatorMongoDB – $pop OperatorMongoDB – $pullAll OperatorMongoDB – $push OperatorMongoDB – Positional Operator ($)MongoDB – All Positional Operator ($[])MongoDB – $position ModifierMongoDB – $addToSet OperatorMongoDB – $each ModifierMongoDB – $sort ModifierMongoDB – $slice ModifierString Expression OperatorsMongoDB $concat OperatorMongoDB $strcasecmp OperatorMongoDB $toUpper OperatorMongoDB $toLower Operator$substrCP (aggregation) operator in MongoDBWorking with Documents and CollectionsDefining, Creating, and Dropping a MongoDB collectionAdding and Querying the data in MongoDBHow to Create Database & Collection in MongoDBMongoDB – Query Documents using Mongo ShellMongoDB – Insert Single Document Using MongoShellMongoDB – Insert Multiple Document Using MongoShellMongoDB – Update Single Document Using MongoShellMongoDB – Update Multiple Documents Using MongoShellMongoDB – Replace Documents Using MongoShellMongoDB – Delete Single Document Using MongoShellMongoDB – Delete Multiple Documents Using MongoShellMongoDB – Check the existence of the fields in the specified collectionSorting Documents in MongoDBCapped Collections in MongoDBIndexing in MongoDBIndexing in MongoDBMongoDB Index TypesMongoDB – Compound IndexesMongoDB – Text IndexesMongoDB – Multikey IndexesMongoDB AdvanceExport data from MongoDBImport data to MongoDBMongoDB – RegexMongoDB ProjectionMongoDB – Embedded DocumentsMongoDB – Query Embedded Documents Using Mongo ShellAggregation in MongoDBHow to Enable Authentication on MongoDB?Create a user and add a role in MongoDBMongoDB – Replication and ShardingMongoDB – Backup and RestorationMore on Mongoose:For more article, you can read recently published article’s on MongoDB: Recent Article on MongoDB and Mongoose: Recent articles on Mongoose Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about! Last Updated : 24 Jan, 2024 Like Article Save Article Previous How does Query.prototype.error() work in Mongoose? Next NodeJS Tutorial Share your thoughts in the comments Add Your Comment Please Login to comment...