Bulk create
/repository/bulk-createJWTCreates many records in one call. The caller is passed through as the author.
For imports that must skip the usual machinery there is createNoChecks, described in its own decorator as bypassing "all collection/workflow/schedule pre/post processing". It backs bulk import, history rewrite and migration.
Skipping pre/post processing also skips search indexing. After a bulk import, run createSearchIndex for the datatype or the records will not appear in full-text results.
Export
/repository/export/:datatypeJWT{ "query": { "data.status": "active" }, "options": { }, "format": "csv", "fields": ["name", "data.email"], "limit": 5000 }format is csv (default) or json. Anything other than "json" produces CSV.
The response is a download, not a JSON body:
Content-Disposition: attachment; filename="<datatype>-<YYYY-MM-DD>.<format>"Transfer-Encoding: chunked— the row count is not known until the last page is read- CSV output begins with a UTF-8 BOM (
), because Excel otherwise reads a bare UTF-8 CSV as the local codepage and mangles non-ASCII text
It is streamed and paged internally, so it is not limited to one page of results and does not buffer the export in memory. Whole-collection exports are fine.
Migration
Move or copy records between collections, optionally reshaping them on the way.
/repository/migrateJWT{
"sources": [
{ "datatype": "lead", "query": { "data.status": "converted" },
"fieldMap": { "data.company": "data.organisation" } }
],
"targetDatatype": "customer",
"targetCollection": { "name": "customer", "title": "Customers", "schema": { } },
"mode": "auto",
"deleteFromSource": false,
"skipDuplicates": true,
"batchSize": 50
}| Field | Type | Description |
|---|---|---|
sources required | array | One or more { datatype, query?, fieldMap? }. query selects records; fieldMap maps source field paths to target field paths. Multiple sources can merge into one target. |
targetDatatype required | string | Destination collection. |
targetCollection | object | { name, title, schema } — creates the target collection if it does not exist. |
mode | `'instant' | 'batch' |
deleteFromSource | boolean | Move rather than copy. Off by default. |
skipDuplicates | boolean | Skip records that already exist in the target. |
batchSize | number | Records per batch. Default 50. |
Tracking a migration
/repository/migrate/status/:jobIdJWT/repository/migrate/jobsJWT/repository/migrate/cancel/:jobIdJWTmigrate/jobs accepts ?status=, ?page= and ?pageSize=.
deleteFromSource: true removes records from the source collection once they are copied. Run the migration without it first and check the result, then re-run to move.
Aggregations
There is no raw MongoDB API: every read and write goes through the repository, so BaseModel stamping, history, search indexing, requiredRole and trash always apply. For queries a plain find cannot express, run an aggregation pipeline against one datatype:
/repository/aggregate/:datatypeJWTThe tenant's orgid selects the database, so a pipeline cannot cross tenants.