Updated on 2023-12-13 GMT+08:00

Creating a Collection

This section describes how to create a collection on the DAS console.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane on the left, choose Development Tool.

    You can also click Go to Development Tool on the overview page.

  5. Locate the DB instance that you want to log in to and click Log In in the Operation column.
  6. On the top menu bar, choose Database Management.

    Figure 1 Database list

  7. On the Collections tab page, click New Collection.

    Figure 2 Database management

  8. On the displayed page, enter a collection name. Select Capped collection, Auto index_id, and No padding as required.

    Figure 3 Creating a collection
    • Capped collection: Set the maximum number of bytes and the maximum number of documents. If the specified value is reached, an error is reported. The value specified must be greater than 0.
    • Auto index: Automatically create an index on the _id field.
    • No padding: A storage policy that does not reserve storage space for the growth of a record when inserting it.

  9. Enter a validation rule and set Validation Level and Validation Action.

    Figure 4 Validation rule
    • Options for Validation Level include:
      • strict: a strict validation level.
      • moderate: a moderate validation level.
      • off: no validation level.
    • Options for Validation Action include:
      • error
      • warn

  10. Ensure that all the settings are correct and click OK. The collection you create appears in the collection list, and you can perform operations on it.