Skip to main content

Overview

Seeds let you export and import objects across all of CXF. Use them to move configuration and data between environments — for example, to promote a setup from one instance to another, seed a new environment, or load large volumes of records. There are two types of seed, with different trade-offs between functionality and speed.

Seed types

Structural seedsInstance seeds
What it’s forExporting and importing the structure and configuration of objectsInserting very large quantities of data
Feature coverageSupports all features; can get very complexLimited — reserved for template instances only
ProcessingOne by oneBulk insert (leverages MongoDB bulk insert)
SpeedSlower, higher fidelityFast, high volume

Structural seeds

Structural seeds support every feature in CXF and can represent complex objects in full detail. Because each object is processed one by one, they carry more functionality at the cost of speed. Use them when fidelity matters — exporting and importing the structure and configuration of your objects.

Instance seeds

Instance seeds are built for volume. They take advantage of MongoDB’s bulk insert to load large quantities of records quickly. In exchange, feature support is more limited, and they are reserved for instances of templates only.
Typical flow: once you’ve defined the structure of a Content Template, use an instance seed to insert large quantities of instances of that template.

Building a structural seed

A structural seed is a JSON array. Each item declares an object_type and a data object holding the record’s fields — the same fields documented on that object’s reference page. Items are processed in order, so a record can reference another that was created earlier in the same seed. Because ids aren’t known ahead of time, structural seeds use reference helpers{{...}} expressions that resolve to a record’s id at insert time:
HelperResolves to
getRecordAttribute(object_type, field, value)The id of a record matched by a field — used for template_id.
getAttributeGroup(object_type, group_slug, template_slug, template_type)The id of a parent group attribute — used for parent_id.
getContentInstance(template_slug, field, value)The id of a content instance. Content instances (and documents) live in a per-template collection, so the template slug is requiredgetRecordAttribute can’t resolve them.
The example below seeds a Blog content template, a Default attribute group, and two attributes nested inside it:
[
  {
    "object_type": "content_templates",
    "data": {
      "title": "Blog",
      "slug": "blog",
      "type": "stories"
    }
  },
  {
    "object_type": "attributes",
    "data": {
      "title": "Default",
      "slug": "default",
      "data_type": "group",
      "appearance": "default",
      "object_type": "content_versions",
      "template_type": "stories",
      "template_id": "{{getRecordAttribute('content_templates', 'slug', 'blog')}}",
      "full_slug": "default"
    }
  },
  {
    "object_type": "attributes",
    "data": {
      "title": "Lecture time",
      "slug": "lecture_time",
      "data_type": "text",
      "appearance": "short",
      "object_type": "content_versions",
      "template_type": "stories",
      "template_id": "{{getRecordAttribute('content_templates', 'slug', 'blog')}}",
      "parent_id": "{{getAttributeGroup('content_versions', 'default', 'blog', 'stories')}}",
      "full_slug": "default.lecture_time"
    }
  },
  {
    "object_type": "attributes",
    "data": {
      "title": "Cover Image",
      "slug": "cover_image",
      "data_type": "media",
      "appearance": "image",
      "is_required": true,
      "object_type": "content_versions",
      "template_type": "stories",
      "template_id": "{{getRecordAttribute('content_templates', 'slug', 'blog')}}",
      "parent_id": "{{getAttributeGroup('content_versions', 'default', 'blog', 'stories')}}",
      "full_slug": "default.cover_image"
    }
  }
]
Content attributes are defined against the content_versions object type and scoped to their content template through template_id. Nested fields point to their group with parent_id and use a dotted full_slug (for example, default.cover_image).

Building an instance seed

An instance seed is a flat JSON array of records inserted in bulk into a single template’s instances. Unlike a structural seed, it has no object_type wrapper and no reference helpers — every record targets the same template (chosen when you run the seed), so there are no ids to cross-reference. For content, each record’s values live inside its versions, and attribute values are grouped under their attribute group’s slug (for example default):
[
  {
    "slug": "sample-content-1",
    "title": "Sample Content 1",
    "versions": [
      {
        "language": "en",
        "environment": "production",
        "status": "draft",
        "title": "English Production Version",
        "slug": "en-production",
        "default": {
          "description": "<p>Sample <strong>formatted</strong> text</p>"
        }
      }
    ]
  }
]
Instance seeds are reserved for template instances and don’t support hierarchy. To create parent-child relationships (for example between Taxonomies), use a structural seed or set them in the UI afterward.

Behaviour & rules

  • A seed is authored as a JSON array and pasted directly into the importer — there’s a live preview that validates the JSON as you type, so only valid input can be imported.
  • Structural seeds are processed one record at a time, in array order, so a later record can reference one created earlier via reference helpers; instance seeds are inserted in bulk into a single template’s instances.
  • Seeds are idempotent — re-importing the same seed won’t create duplicates.
  • A seed can run synchronously, or asynchronously as a background job whose progress you follow under Jobs. A synchronous import is limited to 50 objects; for larger seeds, run it asynchronously (no limit).

Where to find it

Seeds are imported from Docs Explorer → Schemas. Click Import structure seeds to open the Import Structure Seeds panel:
  • Import — paste your JSON array into JSON Input; the Preview pane updates automatically. Toggle Run asynchronously (background job) for large imports, then click Import Seeds.
  • Jobs — track the status of asynchronous import jobs.

Governance & permissions

Only a super admin or Master can import seeds.

Schemas

The shape of the data seeds carry.

Content Templates

Instance seeds operate on template instances.