 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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 does createdCollectionAutomatically mean in MongoDB?
If a collection does not exist then MongoDB creates a collection in indexing part. The createdCollectionAutomatically tells that the operation created a collection.
For our example, let us create a collection with an index −
> db.createCollectionDemo.createIndex({"ClientCountryName":1}); This will produce the following output −
{    "createdCollectionAutomatically" : true,    "numIndexesBefore" : 1,    "numIndexesAfter" : 2,    "ok" : 1 } Let us create a collection with documents −
> db.createCollectionDemo.insertOne({"ClientName":"Larry","ClientCountryName":"US"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd2950be3526dbddbbfb612") } Following is the query to display all documents from a collection with the help of find() method −
> db.createCollectionDemo.find().pretty();
This will produce the following output −
{    "_id" : ObjectId("5cd2950be3526dbddbbfb612"),    "ClientName" : "Larry",    "ClientCountryName" : "US" }Advertisements
 