collectAllInstances
Full name: taxi.stdlib.collectAllInstances
Signature
declare extension function <T> collectAllInstances(collection: lang.taxi.Type<T>): TDescription
Collects and merges all instances of a type from the current data context, bypassing ambiguity checks.
Without this function, a search for T[] will return null when multiple separate collections of T exist
(the result is considered ambiguous). collectAllInstances disables that check and concatenates all found instances
into a single collection.
// Merge homeAddresses and workAddresses into one list
find { person: Person } as {
allAddresses: collectAllInstances(Address)
}Examples
Merges all Address collections on a Person into a single flat list, even though they live in separate fields.
Try it out
Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed