Skip to content

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 ​

PropTypeDescription
selectedstring[]Display names of the selected rows; the parent owns the selection
deletingbooleanParent is running the deletion — disables Cancel and shows a spinner on confirm
errorstringShown in the modal, which then stays open (e.g. a partial-failure message)
pageCountnumberOptional. Rows that can be selected on this page — with total it switches on "select all matching"
totalnumberOptional. How many documents match in all
selectedCountnumberHow many documents the selection stands for when selected does not list them (all matching: the filter is the selection); defaults to selected.length
allMatchingbooleanThe selection is every matching document (a filter held by the parent), not the rows on screen
countingbooleanThe matching documents are being counted (one quick request): the bar shows a spinner
notestringAn honest remark shown under the bar: a refusal, or a count that differs from the list's
confirmNamestringWhen set, the delete must be confirmed by typing this text (MongocampCollectionData uses the collection name for "all matching")

Slots ​

SlotDescription
actionsExtra 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 ​

EventDescription
confirmUser confirmed the deletion — run it now
clearUser asked to clear the selection
openThe confirmation modal is about to open — a good moment to reset a stale error
selectAllThe 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.
  • MongocampUsers does not allow selecting the signed-in user (also not via select-all).
  • MongocampCollectionData offers no selection on GridFS bucket collections (*.files / *.chunks) — manage those through MongocampBucketFiles.
  • 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 MongocampCollectionData the selected documents are deleted with one deleteMany request ({ $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.

Released under the MIT License.