> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Insert To Children By Query

> Insert a field into child objects using a JSONPath query

The Insert To Children By Query command (Command Type: 1018) inserts data into child objects by selecting it from the command result using a JSONPath query and assigning it to a specified field name.

## Overview

The Insert To Children By Query command provides functionality for:

* Inserting a parent-level field into every child object
* Using JSONPath to select which data to inject
* Enriching child objects with data from a different level

## Command Type

**Command Type ID:** 1018

## Parameters

| Parameter     | Type   | Description                                          | Required |
| ------------- | ------ | ---------------------------------------------------- | -------- |
| **fieldName** | string | The name of the field to insert the data into        | Yes      |
| **query**     | string | JSONPath query to select the data from commandResult | Yes      |

## Usage Examples

### Insert Parent ID into Children

```json theme={null}
{
  "command": "insert-to-children-by-query",
  "params": {
    "fieldName": "eventId",
    "query": "$.data.id"
  }
}
```

### Insert Timestamp into Children

```json theme={null}
{
  "command": "insert-to-children-by-query",
  "params": {
    "fieldName": "collectedAt",
    "query": "$.data.timestamp"
  }
}
```

## Common Use Cases

* **Parent-Child Enrichment**: Inject a parent identifier (e.g. event ID) into each child record
* **Metadata Propagation**: Attach parent-level metadata to nested child objects
* **Data Denormalization**: Flatten hierarchical data for downstream sink commands

## Related Commands

* [Insert To Children By Query List](/stream/commands/parse/insert-to-children-by-query-list) - Insert multiple fields at once
* [Insert To Children](/stream/commands/parse/insert-to-children) - Insert parent attributes using key mapping
* [Key Mapping](/stream/commands/parse/key-mapping) - Map fields after insertion
