Server 2.0 and later
The module needs MongoCamp server 3.2 or later (mongocamp-nitro-server, from @sfxcode/nuxt-mongocamp-server ^3.2.1) and @sfxcode/nuxt-ui-formkit ^1.8.0. It runs embedded in your Nuxt app (mongocamp.server.enabled) or as the standalone image of the same package. The Scala mongocamp-server and the 1.x line are no longer supported, and there is no compatibility code for them.
The dependency needs Nitro 3, so add nitro to your app's dependencies; it is a peer dependency of this module.
// nuxt.config.ts — the embedded server
export default defineNuxtConfig({
modules: ['@sfxcode/nuxt-ui-mongocamp'],
mongocamp: {
server: { enabled: true, config: { CONNECTION_DATABASE: 'mongocamp' } },
refreshToken: true,
},
})The server's own migration guide (docs/migration-2.0.md in @sfxcode/nuxt-mongocamp-server) covers the database side: moving from the Scala server, password hashes, and MIGRATION_DROP_SCALA_LEFTOVERS.
What changes for your code
Documents are relaxed Extended JSON. Ids are
{ $oid }, dates{ $date }, integers beyond 2^53{ $numberLong }, decimals{ $numberDecimal }, and date-like text{ $string }.- Plain values come from
idOf(@sfxcode/nuxt-ui-mongocamp/utils) andunwrapExtendedJson(useMongocampExtendedJson). useMongocampFetchAllrows come in this form.MongocampExportAll/useMongocampExportAllJSON and NDJSON files do too. PassextendedJson: 'canonical'(the Keep exact number types checkbox) and a re-import keeps Int32/Int64/Double exactly.- CSV stays plain.
- Plain values come from
Wildcards are case-sensitive on the server.
- The module still searches case-insensitively by default: it sends
filterCaseInsensitive=truewith every wildcard filter. - Match case in
MongocampQueryBar(QueryState.matchCase, kept with saved queries) switches to the fast case-sensitive match. - Components that take a
filtergot amatchCaseprop. The composables takefilterCaseInsensitive.
- The module still searches case-insensitively by default: it sends
Lucene follows Lucene.
useMongocampQuerynow writes the direct forms:_exists_:ffor every type. Like MongoDB$exists, it is also true fornull,''and[].- open ranges as
*. -( … )for negated groups; the De Morgan rewrite is gone.f.0:*for a non-empty array.
A bare date is midnight UTC; as the inclusive upper bound the server reads it as the whole day, so
inRangeandonDaywrite the date as given ([2024-06-15 TO 2024-06-15]).fuzzyandboostare refused by the server (400).Quoted values are exact. A
*inside quotes is literal, and a quoted value that converts (a date, a number) also finds the same text —note:"2024-06-15T12:00:00Z"finds a stored date and date-like text. The module writes wildcards unquoted (name:John\ Do*), so its own filters are unaffected; check hand-written ones.Saved raw Lucene strings keep their text, and the server now reads them by Lucene's rules. In particular,
a AND b OR cmeans "a and b"; write(a AND b) OR c.404 instead of
200 false. Deletes treat "already gone" as done: users, roles, jobs, collections, bucket files, buckets, and documents in the data table.useMongocampErrorhas anotFoundkind. A missing collection shows an error on its info page.byId/byIdsalso take{ $oid }. Thefilterof the bucket file list (useMongocampFiles().listFiles) is a MongoDB query as JSON text, not Lucene; the server ignores a Lucene string there and returns every file.NDJSON import is all or nothing. After an aborted import, nothing is kept; send the whole file again.
What the module uses from 2.0
| Server feature | Where you see it |
|---|---|
count=none | samples, $indexStats and stage previews skip the count (runAggregation(…, { skipCount: true })) |
cursor paging (after= / x-pagination-next) | useMongocampFetchAll pages by cursor; the data table steps next/previous by cursor and sorts by a total order (the chosen sort, then _id). Through CORS (an external server on another origin) the browser can only read x-pagination-next when CORS_HEADERS_EXPOSED lists it: a database first started before 2.7.1 stored a list without it, and cursor reads silently stopped after the first page — server 2.7.1 upgrades such a stored list once |
filterCaseInsensitive | quick search, filter builder, select-all-matching, export, charts, aggregation, copy |
GET /system/capabilities (every user) | the MongoDB badge of MongocampVersion for non-administrators; /system/info and /system/stats are for administrators |
schema analysis sampleSize | full analysis up to 1 000 000 documents (the server reads ~86 000 per second) |
| filters in the request body (2.2) | count (POST …/documents/count), export (POST …/documents/export) and aggregation (filter in the body) take filters of any length |
export end marker trailer=true (2.2) | NDJSON and CSV exports end with the server's end or error marker; the module removes it from the file and reports a file without an end marker as incomplete |
_id by hex text (2.2) | the filter builder offers starts with / ends with / contains on _id (hex characters, any case) |
validation issues (2.3) | a document refused by a declared schema, a before-hook or the collection's validator: the save, delete, import and bulk-edit dialogs name the fields (describeServerError, kind invalid, issues) |
version conflict 409 / 4092 (2.3) | an edit in the data table opens the merge dialog MongocampVersionConflict; elsewhere: "Someone else changed this document …" |
version required 428 / 4281 (2.3) | the data table sends the version with every edit; a document stored without one gets "reload and change it again" |
| declared-collection behaviours (2.3) | see Declared collections: declaration card, read-only system fields, soft delete + restore, history |
| declared indexes (2.4) | MongocampIndexes marks them declared (an own index the declaration dropped: removed at next start) and warns before dropping one |
references + expand (2.4) | a References menu in the data table's query bar; referenced documents shown by name, opened in the view drawer; Show references in the view; export-all JSON/NDJSON can expand |
denied operators $where / $function / $accumulator (2.5) | a refusal names the operator (describeServerError, kind notAllowed); the module never sends them |
| limits (2.5) | a body or file over BODY_MAX_BYTES / GRIDFS_UPLOAD_MAX_BYTES (413) names the limit, an import batch that is too large is split in halves and sent again; PAGING_MAX_ROWS: the data table pages with the size the server used and says so |
limits in the capabilities, 413 codes (2.6) | the module reads bodyMaxBytes, pagingMaxRows, exportMaxDocuments, gridfsUploadMaxBytes from /system/capabilities (useMongocampLimits): the data table and the bucket list offer no page size above the cap, export-all says before the export that it is cut, an upload over the limit is refused without sending it; codes 4131 / 4132 / 4133 get their own messages; MongocampServerInfo lists all limits |
| capped exports (2.6) | export-all reads capped from the end marker (NDJSON/CSV) and x-export-max-documents (JSON) — fewer documents because some were deleted meanwhile is no longer mistaken for the limit |
| declaration details (2.6) | indexes a behaviour asked for are badged for owner (…), the declaration card shows sparse and the soft-delete partial filter; refs[].many and referencedBy are read |
| bucket file search (2.6) | MongocampBucketFiles searches with Lucene in the body of POST …/files/search (no URL limit); PAGING_MAX_ROWS applies to file lists |
| request id (2.5) | a failed answer (5xx) shows its x-request-id in MongocampErrorAlert, with a copy button; the generic 500 text becomes a readable message |
suggested validator GET …/schema/validator (2.3) | Suggest validator in MongocampCollectionInfos (useMongocampAdmin().getSuggestedValidator) |
Server settings worth knowing
AUTH_GRANT_DENIED_STATUS: the status of a missing grant,403by default. Server 2.6 upgrades a401that an older first start stored; a401set on purpose stays. On a401the dependency would clear the session, so the module turns that401into a403(useMongocampClientApi), andMongocampSettingsshows a hint while the setting is401.USERS_READ_HIDE_API_KEY(2.6, defaultfalse): the document routes leave outapiKeyofmc_users. The module stripspasswordandapiKeyfrom everymc_usersrow anyway.FILTER_TIME_ZONE: the zone of dates without one in a filter (default UTC). The module always writes UTC (Z).IMPORT_MAX_BYTES: the size limit of an NDJSON import (413above it).
Updating from 3.1 to 3.2
- Raise
@sfxcode/nuxt-mongocamp-serverto ^3.2.1. What 3.2 changes:- inserts, replaces and imports refuse field names that start with
$(any depth) or contain.(top level) with a400naming the fields (DOCUMENTS_CHECK_FIELD_NAMES, default on; a declaration'scheckFieldNames: falsewins). A dotted name is unreachable anyway — every partial update, filter and sort readsa.bas a path. The import wizard now refuses such names before sending: a CSV column likeaddress.citystops at the header, a JSON key with a dot (at any depth) refuses its row, like a$key already did. The data table's partial updates are unaffected ($setpaths may contain dots); an edit of an old document that still stores a dotted top-level name falls back to a replace, which 3.2 refuses with that400; - a multipart upload's own UTF-8 file name is stored as sent (2.8–3.1 read it as latin1; the module was never affected, it sends
fileName); - audit records carry their own
id(theauditIdof a restore) andactedBy(writes withX-AUTH-ACT-AS) — no UI for either yet.
- inserts, replaces and imports refuse field names that start with
Updating from 3.0 to 3.1
- Raise
@sfxcode/nuxt-mongocamp-serverto ^3.1.0. Nothing breaks; the module uses what 3.1 adds:- the capabilities announce the auth flows — Invite User in
MongocampUsersshows itself when the server runsAUTH_REGISTRATION=invite(theinviteprop still forces it). The logged-out pages keep their props: the capabilities need a login; - users change their own display name on
MongocampAccount(PATCH /auth/profile); - deleting a running queue job says so (
409, code4094) instead of "gone"; - a
mongocamp:readylistener added after the core started is called, so the documented queue-handler pattern works in any plugin order; createMongocampApisshares one middleware list across its APIs again (3.0 gave each its own).
- the capabilities announce the auth flows — Invite User in
- Still not possible: a user changing their own e-mail address (an administrator does it in the users list).
Updating from 2.11 to 3.0
- Raise
@sfxcode/nuxt-mongocamp-serverto ^3.0.0 and read the server's own migration guide (docs/migration/to-3.0.mdof the server): its breaking changes are server defaults, each with a way back. - What changes in the module, and what you may have to do:
| Server change | In the module | Your part |
|---|---|---|
* grants no longer reach mc_*, system.*, a bucket's .files / .chunks, .variants | the permission matrix and useMongocampPermissions follow the new rule | a role that really needs one of them gets a grant naming it (way back: none — use an administrator role) |
mc_users reads leave out apiKey too (USERS_READ_HIDE_API_KEY=true) | the data table already stripped it | — |
| plain whole numbers are stored as Int64 | the data table's typed saves keep the original types; a new field goes in as the server stores it | send { "$numberInt": "3" } where you need Int32 |
RATE_LIMIT_LOGIN defaults to 10/15m | the login form shows the wait (429) | behind a proxy set RATE_LIMIT_TRUSTED_PROXIES |
one error type MongocampRequestError (a ResponseError) | nothing to change | — |
| new error codes 4013, 4014, 4035, 4093, 4403, 5031 | readable messages in useMongocampError, the login and the error alert | — |
$lucene in bulk bodies | delete/update by filter send the filter in the body — no length limit | — |
- New and opt-in — each needs the server setting and a prop or a page of yours (the server announces only sessions), see Authentication flows:
- user fields (display name, e-mail, verified, disabled, last login) and Disable / Enable in
MongocampUsers, shown inMongocampAccount; - sessions (
AUTH_SESSIONS) — the Sessions card of the account page; - registration / invitation / verification (
AUTH_REGISTRATION) —MongocampRegister,MongocampVerifyEmail, Invite User (inviteprop); - password reset (
AUTH_PASSWORD_RESET) —MongocampResetPassword, the login'sforgot-password; - login by e-mail (
AUTH_PASSWORDLESS) — the login'spasswordless,MongocampLoginLink; - the app must send the mails: a Nitro hook
mongocamp:auth:mail(the server sends none); - the job queue — the Queue section of
MongocampJobs; - webhooks —
MongocampWebhooksunderpaths.webhooks(add a page there if you use the module's navigation); - embeddings — a row on the declaration card.
- user fields (display name, e-mail, verified, disabled, last login) and Disable / Enable in
- The four auth pages are public:
paths.register,verifyEmail,resetPassword,loginLinkdefault to the paths of the server's mailed links (AUTH_APP_URL+/register…) and must not match a protected route pattern. - Server code on 3.0.0: a
mongocamp:readyhook registered after another plugin started the core never fires — register queue handlers on the core (useMongocampCore().then(server => server.queue.handle(...))). Server 3.1 calls such a late listener at once, so the documented hook works again. - In server proxy mode there is no login: the auth pages show a note, the account page has no sessions card.
- Not covered: OAuth / identities, two-factor login, the MCP endpoint, the outbox, vector search, hooks in the declaration.
Updating from 2.8 to 2.11
- Raise
@sfxcode/nuxt-mongocamp-serverto ^2.11.0. useMongocampBucketis renamed touseMongocampFiles. The dependency now auto-imports its own typed bucket composableuseMongocampBucket(name)(list,info,upload,update,remove,linkof one declared bucket), which wins the auto-import — a call of the olduseMongocampBucket()without a name now reaches the dependency's composable. Replace it withuseMongocampFiles(); the returned functions and refs are unchanged.- Everything else is additive and only shows where your server declares it:
- full-text search (
searchin a declaration) — a search box in the query bar; - declared views — a Views button in the data table,
MongocampCollectionView; - drafts — the Drafts switch, status badges, the Publishing menu (
useMongocampDrafts); - restore a version from the history (
useMongocampHistory().restoreVersion); - access rules and tenants on the declaration card, and readable refusals (403, code 4033);
- file references and declared buckets — file cells, the bucket badge and referencing collections;
- signed file links (Share link, Revoke all links) — in proxy mode let
/files/signed/through your guard hook (Server proxy auth); - image variants by preset (
thumbnailPreset,previewPreset; needssharpwhere the server runs); - health (
/health/readyin the status block,/health/livefor the offline check), rate limits on the server page and the login form; - backups and migrations —
MongocampMaintenanceunderpaths.maintenance(add a page there if you use the module's navigation).
- full-text search (
- Server 2.9 stores an empty API key as no key; the module no longer sends one.
- Known server gaps (2.11.0): export and aggregate ignore
q; a partial edit of a published document leaves no "pending changes" marker in the working copy;fields/detaillists fields a field rule hides; the bucket information does not answer the declared types or variants.
Updating from 2.6 to 2.8
- Raise
@sfxcode/nuxt-mongocamp-serverto ^2.8.0; nothing else to change in an app that only uses this module. - Your own server code calls the dependency's client
useMongocampEventApi(event, token?)now; the server-sideuseMongocampApi(event)still works but is deprecated (it clashed with the browser composable) and goes in 3.0. - What the module uses since 2.8:
- Copy of a declared collection into an undeclared one leaves the declaration's own
mongocamp_idx_*indexes out; the copy dialog says how many (skippedIndexes). Copies made before 2.8 keep theirs (not managed here badge). - Dropping an index that is already gone (
404, code27) counts as dropped. - Version conflicts: the data table's edit writes ask
extendedJson=canonical, so the stored document of a 409 keeps its exact types and the merged save sends the version as it was stored. - Settings shows where each value comes from (env, option, changed, stored, default), the default under a value that differs, and warns about stored values an older server wrote that nobody changed.
- Version: the badge's tooltip and the server info page name the server core.
- Declared collections:
timestamps.preserveOnInsert/preserveOnUpdate(andowner.preserveOnInsert) let an administrator's write keep the creation/change fields it sends. The declaration card names them; the import wizard says whether the file's values are kept and no longer adds its ownmetaDatastamp to a collection with declaredtimestamps.
- Copy of a declared collection into an undeclared one leaves the declaration's own
- Fixed on the server, nothing to do: an older stored
CORS_HEADERS_EXPOSEDwithoutx-pagination-next(cursor paging through CORS stopped after page 1) and anAGGREGATION_STAGES_DENIEDwithout$collStats/$indexStatsare upgraded once at the start (2.7.1/2.7.2); downloads name non-ASCII files correctly (filename*). - Known in 2.8 (fixed in 3.2): a multipart upload's own file name is read as latin1 (
Übersicht⇒Ãbersicht) — the module always sends the name as thefileNameparameter, which keeps it; and the declaration does not answerowner.preserveOnInsertyet (the server honours it). - New on the server, no UI in the module:
X-AUTH-ACT-AS(an administrator acts for a user) andX-MONGOCAMP-KEEP-TIMESTAMPS.
Updating from 2.5 to 2.6
- Raise
@sfxcode/nuxt-mongocamp-serverto ^2.6.0 and@sfxcode/nuxt-ui-formkitto ^1.8.0 (the reference picker needs 1.8: earlier FUSelectMenu versions empty the search box after every key); nothing else to change. - The edit form relies on nuxt-ui-formkit 1.6 for irregular documents: a field that is
nullwhere other rows hold an object opens as an empty group (its fields optional) and is saved asnullagain; system and protected fields use itsreadonlyoverrides. useMongocampBucket().listFiles(nowuseMongocampFiles) has aluceneoption (POST …/files/search); the JSONfilteroption still works.uploadFilestakesmaxBytes. New:useMongocampLimits.- Server proxy mode builds its client with
createMongocampApisof@sfxcode/nuxt-mongocamp-server/client;useMongocampAdmin().regenerateUserApiKeycallsgenerateNewApiKeyForUser. - Configurations can be reset:
DELETE /system/configurations/{key}(the module's Settings page stays read-only).
Updating from 2.3 to 2.5
- Nothing to change in your code; the module's baseline is 2.5 (
@sfxcode/nuxt-mongocamp-server^2.5.0). - New in the UI: declared indexes and references (2.4), the 2.5 limits and the request id — see the table above.
- Limits are runtime settings (
PATCH /system/configurations/{key}, no restart).PAGING_MAX_ROWS,EXPORT_MAX_DOCUMENTSandGRIDFS_UPLOAD_MAX_BYTESare off by default. (Since 2.6 every user reads them from/system/capabilities.) EXPORT_CSV_ESCAPE_FORMULASprotects the server's CSV export; the data table's own page export offers the same as Export page as CSV for spreadsheets.- Live updates (
useMongocampLive) still need a replica set and have no UI in the module.
Updating from 2.2 to 2.3
useMongocampCollectionis renamed touseMongocampCollectionPaging. The dependency now auto-imports its own typed collection composableuseMongocampCollection(name)(find,insert,update,remove,restore,history, …), which wins the auto-import — a call of the olduseMongocampCollection()without a name now reaches the dependency's composable. Replace it withuseMongocampCollectionPaging(); the returned refs are unchanged.- Everything else is additive: declared collections (
server/mongocamp/*.ts), their behaviours (timestamps, owner, soft delete, versioned writes, audit), live updates (useMongocampLive) and before-hooks only apply to collections you declare. The module's components keep working on any collection; on a declared one an invalid write now says which fields were refused.
Updating from 2.0 to 2.2
MongocampSettingshas no plugins card any more and itshidePluginsprop is gone;useMongocampSystem().getSettings()and theServerPluginstype are removed. The server dropped its plugin model (extensions are Nitro plugins now), so/system/settingsholds only the configuration map — which the module never reads there.FilterTooLongErroris gone: count, export and aggregation send their filter in the request body.- An NDJSON or CSV file from
useMongocampExportAllno longer needsexpectedto be checked;documentsis the server's own count. - The generated client renamed the model
UpdateRequesttoUpdateManyRequest, andGrant.grantTypeis an enum (COLLECTION,BUCKET,BUCKET_META). - Your stored
AUTH_GRANT_DENIED_STATUSstays as it was (see above).
Still in place
- Filters that travel in a URL are capped at 6 000 encoded characters: the bucket file list, and the data table's link to the aggregate page (the filter is in the page's URL). A proxy in front of a server may refuse longer URLs.
- The data table still strips
passwordandapiKeyfrommc_usersrows. 2.2 leaves outpassworditself, but an administrator's read still contains the API key. - The aggregation builder refuses the server's default deny-list up front (
$out,$merge,$function,$accumulator,$where,$currentOp,$listSessions,$collStats,$indexStats). Joins are allowed; the server checks their grants.