Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for MongoDB
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Database migration to Yandex.Cloud
    • Connecting to databases
    • Stop and start the cluster
    • Changing cluster and database settings
    • MongoDB version upgrade
    • Database management
    • Managing hosts in a cluster
    • Managing database users
    • Managing backups
    • How to manage shards
    • Deleting clusters
  • Solutions
    • Sharding collections
  • Concepts
    • Relationship between service resources
    • Host classes
    • Network in Yandex Managed Service for MongoDB
    • Quotas and limits
    • Storage types
    • Backups
    • Replication
    • Sharding
    • Users and roles
    • Supported clients
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1, 2019 to February 1, 2020
  • API reference
    • Authentication in the API
    • gRPC
      • Обзор
      • BackupService
      • ClusterService
      • DatabaseService
      • ResourcePresetService
      • UserService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • addHosts
        • addShard
        • backup
        • create
        • delete
        • deleteHosts
        • deleteShard
        • enableSharding
        • get
        • getShard
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • listShards
        • move
        • rescheduleMaintenance
        • resetupHosts
        • restartHosts
        • restore
        • start
        • stop
        • streamLogs
        • update
      • Database
        • Overview
        • create
        • delete
        • get
        • list
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Operation
        • Overview
        • get
  • Questions and answers
    • General questions
    • Questions about MongoDB
    • All questions on the same page
  1. Step-by-step instructions
  2. Database management

Database management

  • Getting a list of cluster databases
  • Creating a database
  • Deleting a database

You can add and remove databases, as well as view information about them.

Getting a list of cluster databases

Management console
CLI
API
  1. Go to the folder page and select Managed Service for MongoDB.
  2. Click on the name of the cluster you need and select the Databases tab.

If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To get a list of databases in a cluster, run the command:

$ yc managed-mongodb database list
     --cluster-name <cluster name>

The cluster name can be requested with a list of folder clusters.

To get a list of cluster databases, use the list method.

Creating a database

The number of databases in a cluster is unlimited.

Note

Created databases are not available to cluster users by default. To allow a user to connect to a new database, don't forget to grant them the necessary permission.

Management console
CLI
API
  1. Go to the folder page and select Managed Service for MongoDB.

  2. Click on the name of the cluster you need.

  3. Select the Databases tab.

  4. Click Add.

  5. Enter a name for the database and click Add.

  6. Make sure you granted permission to the appropriate cluster user (currently only available via the CLI and API) to access the created DB.

If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

Run the create database command and set the name of the new database:

$ yc managed-mongodb database create <database name>
    --cluster-name <cluster name>

Managed Service for MongoDB runs the create database operation.

The cluster name can be requested with a list of folder clusters.

Make sure you granted permission to access the created database to the appropriate cluster user.

You can create a new database in a cluster using the create method. You can allow access to the created database using the update method.

Deleting a database

Management console
CLI
API
  1. Go to the folder page and select Managed Service for MongoDB.
  2. Click on the name of the cluster you need and select the Databases tab.
  3. Click in the line of the necessary DB and select Delete.

If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To delete a database, run the command:

$ yc managed-mongodb database delete <database name>
     --cluster-name <cluster name>

The cluster name can be requested with a list of folder clusters.

You can delete a database using the delete method.

Warning

Before creating a new database with the same name, wait for the delete operation to complete, otherwise the database being deleted is restored. Operation status can be obtained with a list of cluster operations.

In this article:
  • Getting a list of cluster databases
  • Creating a database
  • Deleting a database
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC