← Back to Features
03

Document References

Link documents across APIs using built-in foreign-key routes. Resolve references inline at read time — no manual joins, no extra round-trips. Dot notation supports deeply nested reference chains, so related data can come back in a single request instead of several sequential fetches.

Creating a link

A reference is created by posting the two record locations together: the document doing the referencing, and the document it points at. VividEcho records that the first document now references the second — the linked id is stored on the referencing document without you having to manage an extra join table yourself.

Resolving references on read

When you read a document back, adding resolveRefs with the name of the linked collection pulls the full linked documents in inline, replacing the stored reference with the actual data. You can chain a second level by joining names with a dot — resolving a linked collection's own references within each resolved document — or resolve several collections at once by separating their names with commas.

# Create a reference
POST /api/orders/{id}/products/{fkId}
# Resolve inline
GET /api/orders?resolveRefs=products

← Back to Features