DB Docs
API Reference
- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
AI/LLM: This documentation page is available in plain markdown format at/db/latest/docs/reference/@tanstack/namespaces/IR/functions/followRef.md
followRef
ts
function followRef(
query,
ref,
collection):
| void
| {
alias?: string;
collection: Collection;
path: string[];
sourceId?: string;
};Defined in: packages/db/src/query/ir.ts:494
Follows the given reference in a query until its finds the root field the reference points to.
Parameters#
query#
ref#
PropRef<any>
collection#
Returns#
| void | { alias?: string; collection: Collection; path: string[]; sourceId?: string; }
The collection, its alias, and the path to the root field in this collection. alias is the alias under which the resolved collection is referenced in the query it was reached from (when the ref crosses into a joined source). It is left undefined when the ref simply resolves to a field on the passed-in collection, in which case the caller already knows the alias.