Skip to content

In-place data update #131

@luizender

Description

@luizender

Hello gays,
Is there a way to do an in-place data update?

For exemple, I have de following rule:

{
  "if": [
    { "some": [{ "var": "groups" }, { "==": [{ "var": "name" }, "group_1"] }] },
    { "merge": [{ "var": "" }, [{ "id": 2, "name": "group_2" }]] }
  ]
}

using the following data:

{
  "id": 1,
  "name": "test",
  "groups": [{ "id": 1, "name": "group_1" }],
  "tags": [{ "id": 1, "name": "tag_1" }],
  "category": {
    "id": 1,
    "name": "category_1",
    "fields": [
      {
        "id": 1,
        "name": "field_1",
        "kind": "str",
        "value": "hello word"
      }
    ]
  }
}

then I want, as result, the following:

{
  "id": 1,
  "name": "test",
  "groups": [
    { "id": 1, "name": "group_1" },
    { "id": 2, "name": "group_2" }
  ],
  "tags": [{ "id": 1, "name": "tag_1" }],
  "category": {
    "id": 1,
    "name": "category_1",
    "fields": [
      {
        "id": 1,
        "name": "field_1",
        "kind": "str",
        "value": "hello word"
      }
    ]
  }
}

As my rule, the field groups in the data was updated to:

[
  { "id": 1, "name": "group_1" },
  { "id": 2, "name": "group_2" }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions