Navigation

Views

Views are read-only results of an aggregation run against a collection. Views provide easy access to the results of an aggregation without requiring the reader of the view to execute the pipeline. Views can also help keep your data secure by only giving users access to a predefined result set, as opposed to having access to the underlying collection.

Compass displays views in the Collections Screen with a special icon, and indicates the collection from which the view was created.

View list

Create a View

To create a view, you must use the Aggregation Pipeline Builder. The output of your pipeline’s final stage becomes the content of the view.

To create a view from your pipeline results:

  1. Create an aggregation pipeline in the pipeline builder.
  2. Click the arrow next to the Save button at the top of the pipeline builder.
  3. Click Create a View.
  4. Enter a name for your view.
  5. Click Create.

Compass creates a view from your pipeline results in the same database where the pipeline was created.

Open a View

To open a view, either:

  • Click the desired view from the Collections screen, or
  • Click the desired view in the left-hand navigation.

After you open a view, Compass shows you that view’s Documents Tab. Compass provides the following information and functionality for the view:

Duplicate a View

You can duplicate a view to modify an existing view while retaining the original.

To duplicate a view:

  1. Hover over the desired view in the left navigation.
  2. Click the appearing Ellipses (…) button.
  3. In the dropdown, click Duplicate View.
  4. Enter a name for the new view.
  5. Click Duplicate.

Drop a View

To drop a view from the database:

  1. Hover over the desired view in the left navigation.
  2. Click the appearing Ellipses (…) button.
  3. In the dropdown, click Drop View.
  4. In the modal, enter the name of the view.
  5. Click Drop Collection.