Navigation

Collections and Views

Note

Creating and dropping collections is not permitted in MongoDB Compass Readonly Edition.

Collections Screen

The Collections screen lists the existing collections and views in the selected database. Each list item includes the name and other general information for the specific collection/view.

To access the Collections screen for a database, from the Databases screen either:

  • Click a Database Name in the main Databases view, or
  • Click a database in the left navigation.
../_images/select-database.png

Collections

The Collections screen displays the following information for each collection in the selected database:

  • Collection name
  • Number of documents in the collection
  • Average size of documents in the collection
  • Total size of all documents in the collection
  • Number of indexes on the collection
  • Total size of all indexes on the collection
  • Collation properties for the collection. Hover over a Collation banner to view the properties for that collection.

Views

Views are read-only results of an aggregation run against a collection. The Collections screen displays the following information for each view in the selected database:

  • View name
  • Collection from which the view was created
  • Total size of all documents in the view
  • Total size of all indexes on the collection

Compass explicitly marks views in the left navigation with a unique icon:

View icon

For more information on views, see Views.

Create a Collection

You can create new collections in an existing database.

1

Click the Create Collection button.

From the Collections screen, click the Create Collection button.

2

Enter the collection information.

In the Create Collection dialog, enter the name of the collection to create.

If you want to create a capped collection, select the Capped Collection checkbox and enter the maximum bytes.

If you want to use custom collation on the collection, select the Use Custom Collation checkbox and select the desired collation settings.

3

Click Create Collection to create the collection.

Drop a Collection

1

Click the trash can icon to delete a collection.

From the Collections screen, click on the trash can for the collection to delete. A confirmation dialog appears.

2

Confirm the collection to delete.

In the dialog, enter the name of the collection to delete.

3

Click Drop Collection to drop the collection.

Collection Details

The Collection Detail screen shows detailed information for a collection, including the documents the collection contains. To see collection details, either:

  • Click a Collection Name in the main Collections screen, or
  • Click a collection in the left navigation.
  • Open the collection in a new tab.
../_images/select-collection.png

After you select a collection, Compass shows you that collection’s Documents tab. Compass provides the following collection information and functionality in the detailed view:

Tabbed View

You can open multiple Collection Detail screens in separate tabs. To open a new tab to view collection details:

1

Click the caret icon next to the database which contains the collection you wish to view.

Image highlighting database caret button
2

Hover over the desired collection.

3

Click the appearing ellipses (…) button.

4

Click Open in New Tab.

←   Performance Query Bar  →