What is the maximum size of a document in MongoDB?

MongoDBDatabaseBig Data Analytics

The document is a record in a collection. Each document has the limitation of 16 MB size. The document is wrapped inside the curly bracket ({}).

Let us create a collection with documents −

> db.demo748.insertOne({_id:101,Name:"Chris",Age:21});
{ "acknowledged" : true, "insertedId" : 101 }
> db.demo748.insertOne({_id:102,Name:"Bob",Age:20});
{ "acknowledged" : true, "insertedId" : 102 }
> db.demo748.insertOne({_id:103,Name:"David",Age:23});
{ "acknowledged" : true, "insertedId" : 103 }
> db.demo748.insertOne({_id:104,Name:"Sam",Age:19});
{ "acknowledged" : true, "insertedId" : 104 }

Display all documents from a collection with the help of find() method −

> db.demo748.find();

This will produce the following output −

{ "_id" : 101, "Name" : "Chris", "Age" : 21 }
{ "_id" : 102, "Name" : "Bob", "Age" : 20 }
{ "_id" : 103, "Name" : "David", "Age" : 23 }
{ "_id" : 104, "Name" : "Sam", "Age" : 19 }
raja
Published on 30-Jun-2020 11:38:38
Advertisements