Skip to content

MongocampExportAll ​

Exports every document of a collection — or every one a filter matches — as JSON, NDJSON or CSV, not only the page on screen. A dialog without a trigger: the parent owns v-model:open. MongocampCollectionData opens it from the export menu (Export all matching…) with the filter, sort and fields of the list.

Props ​

PropTypeDescription
v-model:openbooleanWhether the dialog is open
collectionstringThe collection to export
filterstringLucene filter of the list (empty = all documents)
sortstring[]Sort keys of the list
projectionstring[]Fields of the list (empty = all fields)
totalnumberHow many documents match, when known — shown before the export starts
matchCasebooleanMatch the filter's wildcards case-sensitively (default false: filterCaseInsensitive is sent with a wildcard filter, as the list does)

Behavior ​

  • Choose JSON, NDJSON or CSV, then Export; the server streams the file and it is downloaded when it has arrived (see useMongocampExportAll).
  • No document cap. The dialog shows the bytes received and Cancel: nothing is downloaded after a cancel.
  • The server ends a failing stream with a normal 200, so the file is checked: NDJSON and CSV must end with the server's end marker (removed from the file), JSON with its ]. A file that is cut short is reported as incomplete (the server stopped before the end — try again). A JSON file without a count (total) is named by its size instead of a document count.
  • Keep exact number types (JSON/NDJSON only, off by default) exports canonical Extended JSON, so a re-import keeps Int32 as Int32; the default relaxed file is smaller and stores whole numbers as Int64 on re-import.
  • The filter travels in the request body, so it can be of any length.

Server 2.3 – 2.5 ​

PropDescription
withDeletedA soft-delete collection listed with its deleted documents: the export holds them too
expandThe references the list expands: Expand the references (on by default) for JSON and NDJSON; CSV exports ids and says so

When the server's EXPORT_MAX_DOCUMENTS (server 2.6: read from the capabilities, useMongocampLimits) is below total, the dialog says so before the export (data-test="export-limit"). A file the server stopped at its limit is reported as capped (holds n of m matching documents) — from the export's end marker (NDJSON/CSV) or its x-export-max-documents header (JSON). JSON documents are counted while the file streams.

Released under the MIT License.