MongoDB Show all contents from all collections

前端 未结 8 1768
刺人心
刺人心 2020-12-07 07:45

Is it possible to show all collections and its contents in MongoDB?

Is the only way to show one by one?

8条回答
  •  离开以前
    2020-12-07 08:23

    step 1: Enter into the MongoDB shell.

    mongo

    step 2: for the display all the databases.

    show dbs;

    step 3: for a select database :

    use 'databases_name'

    step 4: for statistics of your database.

    db.stats()

    step 5: listing out all the collections(tables).

    show collections

    step 6:print the data from a particular collection.

    db.'collection_name'.find().pretty()

提交回复
热议问题