Skip to content

Update

Update values of found objects

Prefix: update

Value: Vector of update operators

Can start the pipeline: No

Steps before: find, get, sort, limit, offset

Steps after: -

Operators:

  • Inc - inc{...}
  • Set - set{...}

Example

Input:

collection|test|:q[
    find[
        gt{
            value|num|:n|5|,
        },
    ],
    update[
        set{
            value|num|:n|1000|,
        },
    ],
];

Output:

result:ok[
    response{
        s|data|:ids[
            test|4339ace2-9ab3-4c79-b557-f9b78d66b7f9|,
            test|3677c916-ac4d-40ab-89f4-def1e565e7ab|,
            test|5ff00377-34ac-43b9-8ebb-71bb5ff78ebf|,
            test|7bdd7c8f-e9da-42f6-b473-5a6fd9a1c90f|,
        ],
        s|meta|:update_meta{
            s|count|:n|4|,
        },
    },
];