MongoDB Create Database In Hindi | MongoDB List All Databases

📔 : MongoDB 🔗

MongoDB में databases create करने से पहले ये check कर लें कि हमारे system पर MongoDB सही से connected है या नहीं।

Check on window

windows में check करने के लिए command prompt open करें फिर mongo --version type करें। अगर MongoDB सही से setup है , तो ये command run करने पर आपको version information देखेगी।

हालाँकि हो सकता हो कि आपने MongoDB install किया हो लेकिन आपने system environment variables set न किये हो जिसकी वजह से ये command काम नहीं करेगी , इसलिए एक verify कर लें कि आपने system environment variable set किया है।

Check on Ubuntu

Linux पर MongoDB की presence और status check करने के लिए आप नीचे दी गयी command run करके देख सकते हैं।

mongod --version systemctl status mongod

status अगर stopped आ रहा है तो start कर लें।

MongoDB Change or Create a Database

MongoDB में database switch करने के लिए या database create करने के लिए same command का use किया जाता है। अगर database पहले से बना हुआ है तो change हो जायगा नहीं तो new database create जो जायगा।

use mydatabase

MongoDB list databases

सभी available databases को list करने के लिए show dbs command किया जाता है।

show dbs

Initially अगर database empty है मतलब उसमे उसमे कोई collection या data नहीं है तो वो database list नहीं होगा , आपको वही databases दिखेंगे जो empty नहीं है।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers