MongocampBulkDelete
The selection bar and confirmation modal behind bulk delete in MongocampUsers, MongocampRoles and MongocampCollectionData. It is shown only while rows are selected: "N selected", Delete selected, Clear selection. Delete selected opens a modal that lists up to five of the selected names; nothing is deleted until the modal is confirmed.
You normally don't use it directly. It is documented for apps that build their own table with the same behaviour — pair it with createSelectColumn (checkbox column for UTable's v-model:row-selection) and runBulkDelete (see useMongocampBulkDelete).
Props
| Prop | Type | Description |
|---|---|---|
selected | string[] | Display names of the selected rows; the parent owns the selection |
deleting | boolean | Parent is running the deletion — disables Cancel and shows a spinner on confirm |
error | string | Shown in the modal, which then stays open (e.g. a partial-failure message) |
pageCount | number | Optional. Rows that can be selected on this page — with total it switches on "select all matching" |
total | number | Optional. How many documents match in all |
selectedCount | number | How many documents the selection stands for when selected does not list them (all matching: the filter is the selection); defaults to selected.length |
allMatching | boolean | The selection is every matching document (a filter held by the parent), not the rows on screen |
counting | boolean | The matching documents are being counted (one quick request): the bar shows a spinner |
note | string | An honest remark shown under the bar: a refusal, or a count that differs from the list's |
confirmName | string | When set, the delete must be confirmed by typing this text (MongocampCollectionData uses the collection name for "all matching") |
Slots
| Slot | Description |
|---|---|
actions | Extra buttons in the selection bar, next to Delete selected — MongocampCollectionData puts Edit selected here (see MongocampBulkEdit) |
Keep any dialog an extra action opens outside this component: the bar is only rendered while rows are selected, and a reload clears the selection, so a dialog inside it would be destroyed while it reports a failure.
Events
| Event | Description |
|---|---|
confirm | User confirmed the deletion — run it now |
clear | User asked to clear the selection |
open | The confirmation modal is about to open — a good moment to reset a stale error |
selectAll | The user chose Select all N matching documents (offered when the whole page is selected and total > pageCount) |
The modal closes by itself when deleting goes back to false and there is no error.
Built-in safety rules
- The selection is dropped on every reload, page change, filter or sort, so rows that are no longer on screen can never be deleted.
MongocampUsersdoes not allow selecting the signed-in user (also not via select-all).MongocampCollectionDataoffers no selection on GridFS bucket collections (*.files/*.chunks) — manage those throughMongocampBucketFiles.- Failures don't stop the run: everything that could be deleted is deleted, the rest stays selected and the modal reports how many failed and why.
- In
MongocampCollectionDatathe selected documents are deleted with onedeleteManyrequest ({ $or: [{ _id: … }, …] }) instead of one request each; a request that fails or deletes fewer documents than selected falls back to deleting them one by one, so a short count is never reported as success. An empty filter would delete the whole collection, so it is never sent. "All matching" is a single filtered request (below).
Select all matching
When every row of the page is selected and more documents match, the bar offers Select all N matching documents (like a mail client). The parent then counts the matches (one request) and passes allMatching with selectedCount — selected stays empty, the filter is the selection; the delete confirmation additionally needs the collection name typed. See MongocampCollectionData.