Find() Method in Mongoose Last Updated : 01 Oct, 2025 Comments Improve Suggest changes 8 Likes Like Report The find() method in Mongoose is used to query documents from a collection. It returns a Mongoose Query object, which supports chaining additional operations like sorting, limiting, and filtering.Syntax: Model.find(conditions, [projection], [options], [callback]) In the above syntax: conditions: Specifies the query conditions (like filters) to match documents.projection: Optional. Select which fields to include or exclude from the documents. options: Additional options such as sorting or limiting the number of results.callback: Optional function to execute when the query is completed.Return ValueReturns a Mongoose Query object.When executed, it returns an array of documents matching the conditions. How find() Works in MongooseThe find() function executes a query and returns documents that match the given conditions.It supports query projection to include or exclude specific fields from the results.It also allows you to limit the number of results or sort them by specific fields, offering fine-grained control over your data retrieval process.Example: Using the Mongoose find() Method JavaScript // Filename: index.js const mongoose = require('mongoose'); // Database connection mongoose.connect('mongodb://127.0.0.1:27017/geeksforgeeks', { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true }); // User model const User = mongoose.model('User', { name: { type: String }, age: { type: Number } }); // Only one parameter [query/condition] // Find all documents that matches the // condition name='Punit' User.find({ name: 'Punit'}, function (err, docs) { if (err){ console.log(err); } else{ console.log("First function call : ", docs); } }); // Only Two parameters [condition, query projection] // Here age:0 means don't include age field in result User.find({ name: 'Punit'}, {age:0}, function (err, docs) { if (err){ console.log(err); } else{ console.log("Second function call : ", docs); } }); // All three parameter [condition, query projection, // general query options] // Fetch first two records whose age >= 10 // Second parameter is null i.e. no projections // Third parameter is limit:2 i.e. fetch // only first 2 records User.find({ age: {$gte:10}}, null, {limit:2}, function (err, docs) { if (err){ console.log(err); } else{ console.log("Third function call : ", docs); } }); In this example:'mongoose.connect()': Establishes a connection to the MongoDB database using the provided URI.'UserSchema': Defines the schema for the User model with name and age fields.'User': It represents the Mongoose model for the collection.'User.find()': Executes a query on the User collection to find documents matching the given conditions. We can use additional options to filter, limit, or project specific fields.Below is the sample data in the database before the find() function is executed, We can use any GUI tool or terminal to see the database, like we have used Robo3T GUI tool as shown below: Mongoose CollectionStep 4: Run the ApplicationTo start the application run the following command.node index.jsMongoose find() FunctionUse Cases for Mongoose find() Fetching all documents: Retrieve all documents that match the query condition, useful for displaying lists or datasets.Excluding fields: Sometimes you may want to exclude sensitive data like passwords. The find() function allows you to do that through projection.Limiting results: To prevent performance issues with large datasets, you can limit the number of records returned by the find() function using the limit option.Common Query Options with find()limit: Restricts the number of documents returned.skip: Skips a certain number of documents (useful for pagination).sort: Sorts the results by a specified field (e.g., { age: 1 } for ascending order).select: Specifies which fields to include or exclude in the result (projection). Create Quiz Comment G gouravhammad Follow 8 Improve G gouravhammad Follow 8 Improve Article Tags : MongoDB Mongoose Explore MongoDB Tutorial 7 min read IntroductionHow do Document Databases Work? 6 min read How MongoDB works ? 4 min read MongoDB Introduction 3 min read MongoDB: Getting Started 5 min read MongoDB - Working and Features 6 min read Difference between RDBMS and MongoDB 5 min read MongoDB vs MySQL 5 min read InstallationHow to Install and Configure MongoDB in Ubuntu? 5 min read How to Install MongoDB on MacOS 6 min read How to Install MongoDB on Windows? 5 min read Basics of MongoDBMongoDB - Database, Collection, and Document 6 min read MongoDB Cursor 9 min read DataTypes in MongoDB 8 min read What is ObjectId in MongoDB 5 min read What is a MongoDB Query? 10 min read MongoDB - Create Database using Mongo Shell 4 min read MongoDB | Delete Database using MongoShell 4 min read MongoDB CRUD Operations 3 min read MongoDB MethodsMongoDB - Insert() Method 6 min read MongoDB insertOne() Method - db.Collection.insertOne() 3 min read MongoDB insertMany() Method - db.Collection.insertMany() 6 min read MongoDB - Bulk.insert() Method 2 min read MongoDB - bulkWrite() Method 8 min read MongoDB - Update() Method 7 min read MongoDB - updateOne() Method 4 min read MongoDB updateMany() Method - db.Collection.updateMany() 4 min read MongoDB - Find() Method 3 min read MongoDB - FindAndModify() Method 6 min read MongoDB - FindOne() Method 3 min read MongoDB - findOneAndDelete() Method 6 min read MongoDB - db.collection.findOneAndReplace() Method 6 min read MongoDB - db.collection.findOneAndUpdate() Method 5 min read MongoDB - sort() Method 5 min read MongoDB - copyTo() Method 3 min read MongoDB Count() Method - db.Collection.count() 5 min read MongoDB - countDocuments() Method 5 min read MongoDB - Drop Collection 4 min read MongoDB Remove() Method - db.Collection.remove() 5 min read MongoDB - db.collection.deleteone() 2 min read MongoDB - Distinct() Method 3 min read MongoDB - limit() Method 4 min read MongoDB - skip() Method 4 min read MongoDB | ObjectID() Function 2 min read MongoDB - db.collection.CreateIndex() Method 7 min read createIndexes() Method in MongoDB 5 min read MongoDB - getIndexes() Method 4 min read MongoDB dropIndex() Method 5 min read MongoDB - dropIndexes() Method 3 min read Comparison OperatorsMongoDB - Comparison Query Operators 2 min read MongoDB $cmp Operator 4 min read MongoDB $gt Operator 4 min read MongoDB - $lt Operator 4 min read MongoDB - $eq Operator 4 min read MongoDB - $lte Operator 2 min read MongoDB - $gte Operator 2 min read MongoDB - $ne Operator 2 min read MongoDB $in Operator 4 min read MongoDB - $nin Operator 2 min read Logical OperatorsMongoDB - Logical Query Operators 3 min read MongoDB AND operator ( $and ) 4 min read MongoDB OR operator ( $or ) 6 min read MongoDB NOT operator ( $not ) 5 min read MongoDB NOR Operator ( $nor ) 4 min read Arithmetic OperatorsMongoDB $add Operator 4 min read MongoDB $subtract Operator 4 min read MongoDB $multiply Operator 4 min read MongoDB $divide Operator 4 min read MongoDB $abs operator 4 min read MongoDB $floor Operator 4 min read MongoDB $ceil Operator 3 min read MongoDB $mod Operator 1 min read MongoDB $sqrt Operator 2 min read MongoDB $pow Operator 4 min read MongoDB $exp Operator 3 min read MongoDB $log Operator 3 min read MongoDB $log10 Operator 3 min read MongoDB $ln Operator 5 min read Field Update OperatorsMongoDB - Field Update Operators 5 min read MongoDB - $max Operator 4 min read MongoDB - $min Operator 5 min read MongoDB - $inc Operator 5 min read MongoDB - $mul Operator 5 min read MongoDB - Rename Operator ($rename) 5 min read MongoDB - Current Date Operator ($currentDate) 2 min read MongoDB - $setOnInsert Operator 4 min read MongoDB Bitwise Update Operator 3 min read Array Expression OperatorsMongoDB - $isArray Operator 6 min read MongoDB $size Operator 5 min read MongoDB $arrayElemAt Operator 5 min read MongoDB $concatArrays Operator 4 min read MongoDB $reverseArray Operator 5 min read Like