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

Creating a View

A view is a queryable object whose contents are defined by aggregation pipelines on other collections or views. This section describes how to create a view.

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.
  7. On the displayed Objects tab, choose Views and click Create View.
  8. On the displayed page, enter the view name and collection name.

    Figure 1 Creating a view

  9. Click Add Pipeline Stage. In the displayed dialog box, select an operator and enter an expression.

    Figure 2 Adding a pipeline stage

    The aggregation pipeline you create appears in the list, and you can edit, delete, move up, or move down it.

    Figure 3 Pipeline management

  10. On the Collation tab, click Custom Collation and set collation rules as needed.
  11. After setting the view information, click Save.