Navigation

Collections

Note

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

Collections View

The Collections view lists the existing collections in the database and general information for each collection. To access the Collections view for a database, from the Databases tab either:

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

The Collections view 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
../_images/collection-tab2.png

From this view, in addition to viewing the current collections in the database, you can create or drop collections.

Create a Collection

In addition to the initial collection created during the database creation, you can create new collections in an existing database.

1

Click the Create Collection button.

From the Collections view, 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 view, 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.

View Collection Details

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

  • Click a Collection Name in the main Collections view, or
  • Click a collection in the left-hand pane.
../_images/select-collection.png

MongoDB Compass provides the following collection information in the detailed view:

You can also import and export documents to and from the selected collection from this view. For more information on this process, see Import and Export Data.

←   Performance Query Bar  →