MongoDB do not provide command to create new database directly. Do not need to create Mongo database manually. It is created when you save the documents into the defined collection and database . The MongoDB contains “ db.createCollection()” and is use to create collection manually but not the new database. I’m going to share the following steps to create collections and database. Show all Databases Command When the below show query executed that it return two databases, one is “ admin ” and other is “ local ”. > show dbs admin 0.03125GB local (empty) Define a database name Command > use my_new_db switched to db my_new_db > show dbs admin 0.03125GB local (empty) When the above queries executed, the database “ my_new_db ” is not created yet. Save Command In the last, define a collection named “ customers ” and save a dummy document inside the custome...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers