Skip to content

MongocampCollections

Table of all collections in the default database, with document count, storage size, and index count. Each row links to the collection's info and data pages. Includes a client-side filter input and sortable column headers.

Usage

vue
<template>
  <MongocampCollections
    info-path="/secured/admin/collections"
    data-path="/secured/admin/collections"
    bucket-files-path="/secured/admin/buckets"
  />
</template>

Props

PropTypeDefaultDescription
infoPathstring/secured/admin/collectionsBase path for the info-page link: <infoPath>/<name>
dataPathstring/secured/admin/collectionsBase path for the data-page link: <dataPath>/<name>/data
bucketFilesPathstring/secured/admin/bucketsBase path for the bucket file-browser link (bucket rows only): <bucketFilesPath>/<bucketName> — points at a consumer-owned page rendering MongocampBucketFiles

Columns

ColumnDescription
CollectionName, sortable — GridFS bucket collections (.files/.chunks) show a "bucket" badge
DocumentsDocument count
Size (KB)Storage size
IndexesIndex count
Info / data action buttons, plus bucket actions on bucket-backed rows

Behavior

  • Fetched via collectionApi.listCollections() + collectionApi.getCollectionInformation() per collection.
  • Collections whose name starts with mc (MongoCamp's internal collections) are filtered out.
  • The filter input matches client-side against the already-loaded rows.

Bucket actions

Rows for a .files or .chunks collection (detected via useMongocampBucket's isBucketCollection) get three extra actions:

  • Browse files — links to <bucketFilesPath>/<bucketName>, a consumer-owned page rendering MongocampBucketFiles for that bucket
  • Clear bucket — behind a confirmation modal, deletes every file in the bucket, keeps the bucket itself; refetches the collection list on success
  • Delete bucket — behind a confirmation modal, drops both the .files and .chunks collections permanently; refetches the collection list on success

The .files/.chunks pair is not collapsed into a single row — each stays independently browsable via MongocampCollectionData; the badge and bucket actions are just added to both rows.

Released under the MIT License.