--- type: "fhirpath-function" title: "FHIRPath Function: descendants" function: "descendants" category: "Tree navigation" section: "5.9.2" source: "fhirpath/functions.json" --- # FHIRPath Function: descendants Returns a collection with all descendant nodes of all items in the input collection. The result does not include the items in the input collection themselves. This function is a shorthand for `repeat(children())`. Note that the ordering of the children is undefined and using functions like `first()` on the result may return different results on different platforms. > **Note:** Many of these functions will result in a set of items of different underlying types. It may be necessary to use [`ofType()`](#fn-oftype) as described in the previous section to maintain type safety. See [Type safety and strict evaluation](#type-safety-and-strict-evaluation) for more information about type safe use of FHIRPath expressions. ## Summary - **Category**: Tree navigation - **Section**: `5.9.2` - **Return Type**: `collection` - **Empty Input Result**: `empty` - **Errors on Multiple Input**: `false` ## Description Returns a collection with all descendant nodes of all items in the input collection. The result does not include the nodes in the input collection themselves. ## Arguments - none ## Type Mapping - `Any-Any` ## Example ```fhirpath Patient.descendants() // returns all descendant elements of Patient ```