This recipe covers linking CMS collections together using reference fields.
| Type | Field Type | Relationship | Example |
|---|---|---|---|
| Single Reference | REFERENCE | One-to-one, Many-to-one | Product → Category |
| Multi-Reference | MULTI_REFERENCE | One-to-many, Many-to-many | Product → Tags |
Endpoint: POST /wix-data/v2/collections/create-field
Endpoint: POST /wix-data/v2/collections/create-field
Endpoint: POST /wix-data/v2/bulk/items/insert-references
Endpoint: POST /wix-data/v2/items/replace-references
Note: To remove all references, pass an empty array for newReferencedItemIds.
Endpoint: POST /wix-data/v2/bulk/items/remove-references
Endpoint: POST /wix-data/v2/items/query
| Operator | Description | Example |
|---|---|---|
$eq | Exact match (single reference) | { "category": "id" } |
$hasSome | Has at least one of | { "tags": { "$hasSome": ["id1", "id2"] } } |
$hasAll | Has all of | { "tags": { "$hasAll": ["id1", "id2"] } } |