Skip to content

MongocampCollectionView ​

Runs a declared view (server 2.10): a named, read-only aggregation of a declared collection whose pipeline stays on the server. The server applies the caller's read scope first (grants, owner, tenant, access rules, soft delete) and leaves out fields the caller may not read.

vue
<MongocampCollectionView collection-name="orders" />
<MongocampCollectionView collection-name="orders" view="byStatus" :page-sizes="[25, 50]" />
PropDefaultDescription
collectionName—Required. Its declaration (useMongocampDeclaration) lists the views.
viewfirst declaredThe view chosen first.
pageSizes[10, 20, 50, 100]Offered page sizes; the second one is the start.
  • A select lists the views (name (…) takes parameters); the view's description is shown below it. Nothing runs before Run.
  • Parameters (only for a view with hasParams): one JSON object, Extended JSON allowed ({ "$date": … }); the declaration does not answer their schema, so the server checks them — a refusal (400, code 4010) names the fields under the box ("The view does not accept these parameters: status: …"); text that is no JSON object is refused before sending (utils/viewParams.ts, longs stay exact). Paging reuses the parameters of the shown result.
  • The result: count, Table | Chart (MongocampAggregationChart), page export JSON/CSV, page size and paging — like the aggregation builder. Other failures (a view removed meanwhile: 404) show MongocampErrorAlert.
  • A collection without views (or undeclared) shows "This collection declares no views."

MongocampCollectionData opens it in a dialog from its Views button (only when the collection declares views). Data: useMongocampViews.

Root class mongocamp-collection-view; parts toolbar, table, empty.

Released under the MIT License.