

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 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" }
- Related Questions & Answers
- What does these operators mean (** , ^ , %, //) ?
- What does operator ~= mean in Lua?
- What does # mean in Lua programming?
- What does series mean in pandas?
- What does INT(7) in MySQL mean?
- Strange syntax, what does `?.` mean in JavaScript?
- What does “javascript:void(0)” mean?
- What does the Star operator mean in Python?
- What does the restrict keyword mean in C++?
- What does the volatile keyword mean in C++?
- What does the explicit keyword mean in C++?
- What does the KEY keyword mean in MySQL?
- What does parenthesis mean in MySQL SELECT (COLNAME)?
- What does Kicking the Tires mean in Investment?
- What does axes in the pandas series mean?
Advertisements