| 1 | [vectordb](../README.md) / [Exports](../modules.md) / MergeInsertArgs |
| 2 | |
| 3 | # Interface: MergeInsertArgs |
| 4 | |
| 5 | ## Table of contents |
| 6 | |
| 7 | ### Properties |
| 8 | |
| 9 | - [whenMatchedUpdateAll](MergeInsertArgs.md#whenmatchedupdateall) |
| 10 | - [whenNotMatchedBySourceDelete](MergeInsertArgs.md#whennotmatchedbysourcedelete) |
| 11 | - [whenNotMatchedInsertAll](MergeInsertArgs.md#whennotmatchedinsertall) |
| 12 | |
| 13 | ## Properties |
| 14 | |
| 15 | ### whenMatchedUpdateAll |
| 16 | |
| 17 | • `Optional` **whenMatchedUpdateAll**: `string` \| `boolean` |
| 18 | |
| 19 | If true then rows that exist in both the source table (new data) and |
| 20 | the target table (old data) will be updated, replacing the old row |
| 21 | with the corresponding matching row. |
| 22 | |
| 23 | If there are multiple matches then the behavior is undefined. |
| 24 | Currently this causes multiple copies of the row to be created |
| 25 | but that behavior is subject to change. |
| 26 | |
| 27 | Optionally, a filter can be specified. This should be an SQL |
| 28 | filter where fields with the prefix "target." refer to fields |
| 29 | in the target table (old data) and fields with the prefix |
| 30 | "source." refer to fields in the source table (new data). For |
| 31 | example, the filter "target.lastUpdated < source.lastUpdated" will |
| 32 | only update matched rows when the incoming `lastUpdated` value is |
| 33 | newer. |
| 34 | |
| 35 | Rows that do not match the filter will not be updated. Rows that |
| 36 | do not match the filter do become "not matched" rows. |
| 37 | |
| 38 | #### Defined in |
| 39 | |
| 40 | [index.ts:690](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L690) |
| 41 | |
| 42 | ___ |
| 43 | |
| 44 | ### whenNotMatchedBySourceDelete |
| 45 | |
| 46 | • `Optional` **whenNotMatchedBySourceDelete**: `string` \| `boolean` |
| 47 | |
| 48 | If true then rows that exist only in the target table (old data) |
| 49 | will be deleted. |
| 50 | |
| 51 | If this is a string then it will be treated as an SQL filter and |
| 52 | only rows that both do not match any row in the source table and |
| 53 | match the given filter will be deleted. |
| 54 | |
| 55 | This can be used to replace a selection of existing data with |
| 56 | new data. |
| 57 | |
| 58 | #### Defined in |
| 59 | |
| 60 | [index.ts:707](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L707) |
| 61 | |
| 62 | ___ |
| 63 | |
| 64 | ### whenNotMatchedInsertAll |
| 65 | |
| 66 | • `Optional` **whenNotMatchedInsertAll**: `boolean` |
| 67 | |
| 68 | If true then rows that exist only in the source table (new data) |
| 69 | will be inserted into the target table. |
| 70 | |
| 71 | #### Defined in |
| 72 | |
| 73 | [index.ts:695](https://github.com/lancedb/lancedb/blob/92179835/node/src/index.ts#L695) |