MongoDB - Embedded Documents Last Updated : 17 Sep, 2025 Comments Improve Suggest changes 6 Likes Like Report MongoDB provides you a cool feature which is known as Embedded or Nested Document. Embedded document or nested documents are those types of documents which contain a document inside another document. Or in other words, when a collection has a document, this document contains another document, another document contains another sub-document, and so on, then such types of documents are known as embedded/nested documents. Notes - In MongoDB, you can only nest document up to 100 levels. The overall document size must not exceed 16 MB.Creating Embedded Documents -In MongoDB, you can easily embed a document inside another document. As we know that in the mongo shell, documents are represented using curly braces ( {} ) and inside these curly braces we have field-value pairs. Now inside these fields, we can embed another document using curly braces {} and this document may contain field-value pairs or another sub-document. Syntax: {....field: {field1: value1, field2: value2}....}Let us discuss this concept with the help of the given examples - Example 1: Suppose we have a database named 'GeeksforGeeks'. Now this database has a collection named 'Courses' and this collection contains a document. Inside this document, we have a field named 'name' which contains another document and this document contain three fields(i.e, first, middle, last) with their values. Example 2: Again, we are taking GeeksforGeeks database. Inside this database, we already have a collection named 'Courses', now we add another document in this collection, which contains the details of the student who select paid courses. Inside this document, we have a field named 'courseDetails'. This field contains a document and this document contains some field-value pairs and a sub-document which contains the paymentDetials. So, overall the Courses collection contains two documents and these documents contain nested documents. Create Quiz Comment A ankita_saini Follow 6 Improve A ankita_saini Follow 6 Improve Article Tags : MongoDB MongoDB Explore IntroductionHow do Document Databases Work?6 min readHow MongoDB works ?4 min readMongoDB Introduction3 min readMongoDB: Getting Started5 min readMongoDB - Working and Features6 min readDifference between RDBMS and MongoDB5 min readMongoDB vs MySQL5 min readInstallationHow to Install and Configure MongoDB in Ubuntu?5 min readHow to Install MongoDB on MacOS6 min readHow to Install MongoDB on Windows?5 min readBasics of MongoDBMongoDB - Database, Collection, and Document6 min readMongoDB Cursor9 min readDataTypes in MongoDB8 min readWhat is ObjectId in MongoDB5 min readWhat is a MongoDB Query?10 min readMongoDB - Create Database using Mongo Shell4 min readMongoDB | Delete Database using MongoShell4 min readMongoDB CRUD Operations3 min readMongoDB MethodsMongoDB - Insert() Method6 min readMongoDB insertOne() Method - db.Collection.insertOne()3 min readMongoDB insertMany() Method - db.Collection.insertMany()6 min readMongoDB - Bulk.insert() Method2 min readMongoDB - bulkWrite() Method8 min readMongoDB - Update() Method7 min readMongoDB - updateOne() Method4 min readMongoDB updateMany() Method - db.Collection.updateMany()4 min readMongoDB - Find() Method3 min readMongoDB - FindAndModify() Method6 min readMongoDB - FindOne() Method3 min readMongoDB - findOneAndDelete() Method6 min readMongoDB - db.collection.findOneAndReplace() Method6 min readMongoDB - db.collection.findOneAndUpdate() Method5 min readMongoDB - sort() Method5 min readMongoDB - copyTo() Method3 min readMongoDB Count() Method - db.Collection.count()5 min readMongoDB - countDocuments() Method5 min readMongoDB - Drop Collection4 min readMongoDB Remove() Method - db.Collection.remove()5 min readMongoDB - db.collection.deleteone()2 min readMongoDB - Distinct() Method3 min readMongoDB - limit() Method4 min readMongoDB - skip() Method4 min readMongoDB | ObjectID() Function2 min readMongoDB - db.collection.CreateIndex() Method7 min readcreateIndexes() Method in MongoDB5 min readMongoDB - getIndexes() Method4 min readMongoDB dropIndex() Method5 min readMongoDB - dropIndexes() Method3 min readComparison OperatorsMongoDB - Comparison Query Operators2 min readMongoDB $cmp Operator4 min readMongoDB $gt Operator4 min readMongoDB - $lt Operator4 min readMongoDB - $eq Operator4 min readMongoDB - $lte Operator2 min readMongoDB - $gte Operator2 min readMongoDB - $ne Operator2 min readMongoDB $in Operator4 min readMongoDB - $nin Operator2 min readLogical OperatorsMongoDB - Logical Query Operators3 min readMongoDB AND operator ( $and )4 min readMongoDB OR operator ( $or )6 min readMongoDB NOT operator ( $not )5 min readMongoDB NOR Operator ( $nor )4 min readArithmetic OperatorsMongoDB $add Operator4 min readMongoDB $subtract Operator4 min readMongoDB $multiply Operator4 min readMongoDB $divide Operator4 min readMongoDB $abs operator4 min readMongoDB $floor Operator4 min readMongoDB $ceil Operator3 min readMongoDB $mod Operator1 min readMongoDB $sqrt Operator2 min readMongoDB $pow Operator4 min readMongoDB $exp Operator3 min readMongoDB $log Operator3 min readMongoDB $log10 Operator3 min readMongoDB $ln Operator5 min readField Update OperatorsMongoDB - Field Update Operators5 min readMongoDB - $max Operator4 min readMongoDB - $min Operator5 min readMongoDB - $inc Operator5 min readMongoDB - $mul Operator5 min readMongoDB - Rename Operator ($rename)5 min readMongoDB - Current Date Operator ($currentDate)2 min readMongoDB - $setOnInsert Operator4 min readMongoDB Bitwise Update Operator3 min readArray Expression OperatorsMongoDB - $isArray Operator6 min readMongoDB $size Operator5 min readMongoDB $arrayElemAt Operator5 min readMongoDB $concatArrays Operator4 min readMongoDB $reverseArray Operator5 min readArray Update OperatorsMongoDB $pull Operator5 min readMongoDB - $pop Operator4 min readMongoDB - $pullAll Operator3 min readMongoDB $push Operator5 min readMongoDB - Positional Operator ($)4 min readMongoDB All Positional Operator ($[])4 min readMongoDB - $position Modifier4 min readMongoDB $addToSet Operator3 min readMongoDB - $each Modifier3 min readMongoDB - $sort Modifier4 min readMongoDB - $slice Modifier4 min read Like