-->

DEVOPSZONES

  • Recent blogs

    How to Create MongoDB database and Collections

    How to Create MongoDB database and Collections

    MongoDB

    MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schema. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License. After you install MongoDB Please do the following:

    1. Connect to the Mongo Shell.
    [root@mongotest ~]# mongo mongotest:27017

    2. List all Databases.
    > show dbs
    local  0.031GB

    3. Create a Database.
    > use profiles
    switched to db profiles

    > show dbs
    local  0.031GB

    4. Show DB still not showing the DB. You need to add at least one Collection to make this DB visible.
    > db.Firstname.insert({"name":"Manas"})
    WriteResult({ "nInserted" : 1 })

    > show dbs
    local     0.031GB
    profiles  0.031GB

    5. Show all collections.
    > show collections
    Firstnamesystem.indexes

    6. Show existing DB in Use.
    > db
    profiles

    Useful MongoDB Articles:

    No comments