Mongodb Show Collection - MongoDB Tutorial




Mongodb Show Collection

MongoDb

  • In mongoDB “show” command is used to display the available data like database, collection etc.

Syntax (Show Database) :

show db  

Here in this syntax , we display the available data base.

Syntax (Show Collection) :

SHOW INDEXES [IN <database_name>] [FOR COLLECTION <collection_name>]
  • List all of the indexes for the indicated database and collection.
  • If collection_name is not specified, this command will list all the indexes in the indicated database.
  • If database_name is not specified, this command defaults to the current database.

Syntax (Show Index Fields) :

SHOW INDEXFIELDS IN collection_name [IN <database_name>] [FOR INDEX <index_name>]
  • List all of the index fields for the indicated database, collection and index.
  • If database_name is not specified, this command defaults to the current database.

Syntax (Show Users) :

SHOW USERS [IN <database_name>] [FOR USER <user_name>]
  • Here in this syntax SHOW USERS will List the users of the indicated database and describe their USER_PERMISSIONS.
  • If database_name is not specified, then this command defaults to the current database.

Syntax (Show Roles) :

SHOW ROLES [IN <database_name>] [FOR USER <role_name>]
  • Here in this syntax SHOW ROLES will List the roles of the user in the current database or the specified database. This is equivalent to MongoDB's db.runCommand({rolesInfo}) command.
  • The following columns are displayed for SHOW ROLE:
    • role,
    • db,
    • isBuiltin,
    • roles,
    • inheritedRoles,
    • privileges & inherited Privileges

Syntax (show RS_Status) :

SHOW RS_STATUS
  • Here in this statement is used for list out of the current database or the specified database. This is equivalent to MongoDB's

Syntax (show SH_Status) :

SHOW SH_STATUS
  • Here we display the clustered & data sharing document only visible.
MongoDb

  1. Here in this statement “show collections” we have printed the list of collections in the database.


Related Searches to Mongodb Show Collection - MongoDB Tutorial

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×