Import into MongoDB — CSV, Excel & PDF
Questi contenuti non sono ancora disponibili nella tua lingua.
Goal: your users bring the file they have — CSV, Excel, even a PDF or a scan — and clean records land in MongoDB without leaving your product, and without you writing a mapping/validation UI. The pattern is the same every time: embed → validate → deliver. Mildport handles the first two; your webhook handler owns the write into MongoDB.
1. Embed the importer
Section titled “1. Embed the importer”<mildport-import api-base-url="https://imports.your-infra.example" license-key="SIGNED_TENANT_KEY" catalog-key="contacts"></mildport-import>2. Publish a catalog that mirrors MongoDB
Section titled “2. Publish a catalog that mirrors MongoDB”The schema lives in a target catalog, not in host code.
Create it in the catalog editor (/admin/catalogs on your engine, or embed
<mildport-catalog-editor>), match the collection you will write, and publish. The
widget loads that published catalog by catalog-key.
Use dotted keys that match the document shape (contacts.email, contacts.last_name).
Mark the fields your unique indexes require so a duplicate does not surface as a write
error after apply.
Users then upload anything — renamed headers, six languages, XLSX/ODS, even PDF tables — and Mildport’s deterministic matcher plus the review step produce typed, validated rows.
Need the schema computed per user at runtime, or versioned with your app? That’s the
schema-as-code path — pass targets
from host code instead of catalog-key.
3. Deliver from your webhook
Section titled “3. Deliver from your webhook”Clean rows arrive on your signed apply webhook; your handler writes to MongoDB:
bulkWrite with upserts on your natural key — e.g. { updateOne: { filter: { email }, update: { $set: doc }, upsert: true } }MongoDB-specific gotchas
Section titled “MongoDB-specific gotchas”- pick a natural key (email, externalId) and upsert on it — the signed webhook retries deliveries, so the handler MUST be idempotent.
- index that key before the first big import, not after.
- insert typed values (real Date objects, numbers), not strings — the importer’s typed columns make this a one-line conversion.
Why not hand-rolled import?
Section titled “Why not hand-rolled import?”mongoimport is ops tooling for people with shell access. Your users need mapping, validation and review in the product — and your handler needs documents that already fit the collection’s shape.
Try the flow first: the playground (no signup), then the Quickstart and target catalogs. Prices are published — hosted and flat-annual self-host — at mildport.com/#pricing.