MongocampBulkEdit
The dialog behind Edit selected in MongocampCollectionData: set one field to the same value on every selected document. It is the dialog only — the trigger button lives in the selection bar of MongocampBulkDelete (through its actions slot) and the parent runs the update, so a failed update keeps the dialog open even though the table reloads and the bar disappears.
You normally don't use it directly. It is documented for apps that build their own table with the same behaviour.
Props
| Prop | Type | Description |
|---|---|---|
open (v-model:open) | boolean | Whether the dialog is open |
selected | number | How many documents are selected (shown in the title and the confirm button) |
fields | { key: string, type: 'string' | 'number' | 'boolean' | 'date-time' | 'json', bson?: BsonType, mixed?: boolean }[] | Fields the user can choose from; type is the starting value type, bson the field's dominant BSON type (from useMongocampFieldTypes) which preselects an exact numeric type, mixed marks a field that holds more than one kind of value |
saving | boolean | The parent is running the update — disables the buttons and shows a spinner |
error | string | Shown in the dialog, which then stays open |
Events
| Event | Payload | Description |
|---|---|---|
apply | { field: string, value: unknown, bson?: BsonType } | The user confirmed — run the update now. bson is the type to write the value as (the parent wraps it with wireValue); absent means plain JSON and the server picks the type |
The dialog closes by itself when saving goes back to false and there is no error.
The value
The user picks the field, the value type and types the value; a boolean uses a true/false select. The value is converted with the same rules as an import: numbers must be plain numbers, dates ISO 8601 (read as UTC, stored as an ISO string with milliseconds), JSON must parse. An invalid or missing value shows the reason and disables Update. An empty text is a valid value only for a Text field.
Types
The value type offers the import types plus the exact numeric BSON types: Integer (int32), Long (int64), Double, Decimal128. A field starts on its own type when it is known — editing an int field stays an int instead of silently becoming a long. The exact types are checked as typed text (an int must be a whole number in the int32 range, a long keeps every digit) and the dialog refuses a value that does not fit. A Text value that looks like a timestamp is written as text ({ $string }), because the server would otherwise store it as a date; a Date is written as { $date }. A field with more than one kind of value shows a note and asks you to choose. Without the field analysis the plain type is used, as before.
How MongocampCollectionData applies it
- Which fields — the scalar fields of the loaded rows (text, number, boolean, date). Never
_id, themetaDataobject, arrays/objects, or names starting with$or containing a dot. - One request per 100 documents —
documentApi.updateManywith the filter{ $or: [{ _id: "<id>" }, …] }and the document{ field: value }. The server merges that document into every match, so other fields (including nested ones) are untouched. An empty id list is refused before any request: an empty filter would update the whole collection. - Failures are reported, never hidden — if a request fails, or
updateManymatches fewer documents than the chunk held (some were deleted meanwhile), that chunk counts as failed: its rows that are still on screen stay selected and the dialog saysN of M could not be updated: <reason>. Everything else is updated. - Ids the server cannot address — a document whose
_idis not a 24-character hex string cannot be updated through this API (neither bulk nor single); those rows fail immediately with a message and no request. metaDatais not touched — a bulk edit does not changecreatedBy/updatedBy/timestamps.
Related
MongocampBulkDelete— the selection bar the trigger sits in- Strings live under
nuxtUiMongocamp.bulk.edit*in the English and German locale files