memongo
    Preparing search index...

    Type Alias JSONUpdate

    JSONUpdate: {
        [key: string]:
            | JSONValueOrUndefined
            | typeof REMOVE
            | JSONPatchFunction<any>;
    }

    A map of dot-notation paths to update patches.

    Each patch may be:

    • a direct value to write at the path
    • a function that receives the current value at the path and returns the next value
    • undefined, in which case the patch should be ignored
    • the unique symbol REMOVE, in which case the property at the path should be deleted

    Type Declaration

    const update: JSONUpdate = {
    "user.profile.name": "Sinber", // Direct value
    "user.profile.age": (oldAge: number) => oldAge + 1, // Functional patch
    "items.1.discount": undefined, // Which should be skipped
    "user.profile.email": REMOVE, // Remove the email property
    };