移除重复节点(Remove Duplicates node)#
使用 Remove Duplicates 节点识别并删除以下项目:
🌐 Use the Remove Duplicates node to identify and delete items that are:
- 在单次执行中,所有字段或部分字段完全相同。
- 与先前执行中出现的项相同或更差。
这在可能出现重复数据的情况下非常有用,例如用户创建多个账户,或客户多次提交相同的订单。在处理大数据集时,发现并删除这些项目会变得更加困难。
🌐 This is helpful in situations where you can end up with duplicate data, such as a user creating multiple accounts, or a customer submitting the same order multiple times. When working with large datasets it becomes more difficult to spot and remove these items.
通过与先前执行的数据进行比较,删除重复项节点可以删除在早期执行中已出现的项目。它还可以确保新项目的日期较晚或数值高于之前的值。
🌐 By comparing against data from previous executions, the Remove Duplicates node can delete items seen in earlier executions. It can also ensure that new items have a later date or a higher value than previous values.
1.64.0 版的主要更改
n8n 团队在 n8n 1.64.0 中对该节点进行了全面改造。本文档反映了该节点的最新版本。如果你使用的是较旧版本的 n8n,可以在这里找到该文档的旧版本。
操作模式(Operation modes)#
根据 operation 参数的值,删除重复项节点的工作方式有所不同:
🌐 The remove duplication node works differently depending on the value of the operation parameter:
- 删除当前输入中重复的项目:识别并删除当前输入中所有字段或部分字段的重复项目。
- 删除先前执行中处理的项目:将当前输入中的项目与先前执行中的项目进行比较,并删除重复项。
- 清除去重历史:清除之前执行中项目的记录。
移除当前输入中的重复项(Remove Items Repeated Within Current Input)#
当你将“操作”字段设置为在当前输入中删除重复项时,删除重复节点会识别并移除当前输入中的重复项。它可以在所有字段中执行此操作,也可以仅在部分字段中执行。
🌐 When you set the "Operations" field to Remove Items Repeated Within Current Input, the Remove Duplicate node identifies and removes duplicate items in the current input. It can do this across all fields, or within a subset of fields.
移除当前输入中的重复项参数(Remove Items Repeated Within Current Input parameters)#
在使用 删除当前输入中重复项 操作时,可用以下参数:
🌐 When using the Remove Items Repeated Within Current Input operation, the following parameter is available:
- 比较:选择 n8n 应该比较输入数据的哪些字段,以检查它们是否相同。可用的选项如下:
- 所有字段:比较输入数据的所有字段。
- 除以下字段外:输入 n8n 在比较时应排除的输入数据字段。你可以提供多个值,用逗号分隔。
- 所选字段:输入 n8n 在比较中应包含的输入数据字段。你可以输入多个值,用逗号分隔。
移除当前输入中的重复项选项(Remove Items Repeated Within Current Input options)#
如果你选择 除所有字段外 或 所选字段 作为比较类型,你可以添加以下选项:
🌐 If you choose All Fields Except or Selected Fields as your compare type, you can add these options:
- 禁用点表示法:设置是否使用点表示法来引用格式为
parent.child的子字段(关闭表示禁用,开启表示启用)。 - 删除其他字段:设置是否删除在比较中未使用的任何字段(开启)或不删除(关闭)。
移除先前执行中已处理的项目(Remove Items Processed in Previous Executions)#
当你将“操作”字段设置为移除之前执行中处理的项目时,移除重复节点会将当前输入中的项目与之前执行中的项目进行比较。
🌐 When you set the "Operation" field to Remove Items Processed in Previous Executions, the Remove Duplicate node compares items in the current input to items from previous executions.
移除先前执行中已处理的项目选项参数(Remove Items Processed in Previous Executions parameters)#
在使用 删除之前执行中处理的项目 操作时,可用以下参数:
🌐 When using the Remove Items Processed in Previous Executions operation, the following parameters are available:
- 保留项目位置:选择 n8n 决定保留哪些项目的方式。可用选项如下:
- 值是新的:如果项目的值与之前执行的项目匹配,n8n 会删除这些项目。
- 值高于以往任何值:如果当前值不高于之前的值,n8n 会删除该项目。
- 值是晚于任何先前日期的日期:如果当前日期不晚于以前的日期,n8n 会删除日期项目。
- 去重依据:要比较的输入字段。你为 保留符合条件的项目 参数选择的选项将决定你需要的确切格式:
- 使用 Value Is New 时,这必须是一个具有唯一 ID 的输入字段或字段组合。
- 在使用 值高于任何先前值 时,这必须是一个具有递增值的输入字段或字段组合。
- 使用 值是晚于任何先前日期的日期 时,此字段必须是包含 ISO 格式日期值的输入字段。
移除先前执行中已处理的项目选项(Remove Items Processed in Previous Executions options)#
在使用 删除之前执行中处理的项目 操作时,可用以下选项:
🌐 When using the Remove Items Processed in Previous Executions operation, the following option is available:
- 范围:设置 n8n 存储和使用去重数据进行比较的方式。可用的选项如下:
- 节点:(默认)独立存储此节点的数据,与工作流中的其他“删除重复项”实例无关。使用此作用域时,你可以清除此节点实例的重复历史记录,而不会影响其他节点。
- 工作流:在工作流级别存储重复数据。这会将重复数据与任何其他设置为使用“工作流”范围的去重节点共享。 n8n 仍会独立管理设置为“节点”范围的其他去重节点的重复数据。
当你选择 值是新的 作为 保留项的位置 选项时,此选项也可用:
🌐 When you select Value Is New as your Keep Items Where choice, this option is also available:
- 历史大小:n8n 用于跨执行跟踪重复项的存储项目数量。范围选项的值决定此历史大小是仅针对此单个“删除重复项”节点实例,还是与工作流中的其他实例共享。默认情况下,n8n 存储 10,000 个项目。
清除数据去重历史记录(Clear Deduplication History)#
当你将“操作”字段设置为清除去重历史时,“删除重复项”节点会管理并清除之前执行中存储的项目。此操作不会影响当前输入中的任何项目。相反,它管理的是“删除之前执行中已处理的项目”操作所使用的项目数据库。
🌐 When you set the "Operation" field to Clear Deduplication History, the Remove Duplicates node manages and clears the stored items from previous executions. This operation doesn't affect any items in the current input. Instead, it manages the database of items that the "Remove Items Processed in Previous Executions" operation uses.
清除数据去重历史记录参数(Clear Deduplication History parameters)#
在使用 清除去重历史 操作时,可以使用以下参数:
🌐 When using the Clear Deduplication History operation, the following parameter is available:
- 模式:你希望如何管理存储在数据库中的键/值项。可用的选项如下:
- 清理数据库:删除数据库中存储的所有重复数据。这将把重复数据库重置为初始状态。
清除数据去重历史记录选项(Clear Deduplication History options)#
在使用清除去重历史操作时,可用以下选项:
🌐 When using the Clear Deduplication History operation, the following option is available:
- 范围:设置 n8n 在管理重复数据库时使用的范围。
- 节点:(默认)管理特定于此“删除重复项”节点实例的重复数据库。
- 工作流:管理由所有使用工作流范围的去重节点实例共享的去重数据库。
模板和示例(Templates and examples)#
有关使用“删除重复项”节点的模板及其使用示例,请参阅 模板和示例。
🌐 For templates using the Remove Duplicates node and examples of how to use it, refer to Templates and examples.
相关资源(Related resources)#
Learn more about data structure and data flow in n8n workflows.