Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the maximum size of a document in MongoDB?
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 }Advertisements