Skip to main content
Version: 2.0.0-alpha

References

Use reference fields when you need to establish relations between collections. For example, you may have a product that is related to one category, or one that has multiple purchases.

When you set up a FireCMS app, you define collections under paths (or path aliases), and those are the paths that you use to configure reference properties.

Single reference field

Field

import { buildProperty } from "@camberi/firecms";

buildProperty({
dataType: "reference",
path: "users",
name: "Related client",
});

The data type is reference

Internally the component used is ReferenceFieldBinding.

Multiple reference field

Field

import { buildProperty } from "@camberi/firecms";

buildProperty({
dataType: "array",
name: "Related products",
of: {
dataType: "reference",
path: "products"
}
});

The data type is array with a reference property as the of prop.

Internally the component used is ArrayOfReferencesFieldBinding.