@ptkl/sdk - v1.3.4
    Preparing search index...

    Type Alias UpdateOperators

    MongoDB update operators that can be included inline in the data payload.

    Any key starting with $ in the data object is automatically detected as an update operator and applied with MongoDB semantics instead of the default $set.

    Supported operators:

    • $inc — Increment a numeric field
    • $push — Append to an array
    • $pull — Remove from an array by condition
    • $addToSet — Add to array only if not present
    • $pop — Remove first (-1) or last (1) element from array
    • $unset — Remove a field from the document
    • $min — Update only if new value is less than current
    • $max — Update only if new value is greater than current
    • $mul — Multiply a numeric field
    // Data with inline operators
    const data = {
    name: "John", // → $set
    $inc: { views: 1 }, // → $inc
    $push: { tags: "vip" } // → $push
    }
    type UpdateOperators = {
        $addToSet?: Record<string, any>;
        $inc?: Record<string, number>;
        $max?: Record<string, any>;
        $min?: Record<string, any>;
        $mul?: Record<string, number>;
        $pop?: Record<string, 1 | -1>;
        $pull?: Record<string, any>;
        $push?: Record<string, any>;
        $unset?: Record<string, "">;
    }
    Index

    Properties

    $addToSet?: Record<string, any>
    $inc?: Record<string, number>
    $max?: Record<string, any>
    $min?: Record<string, any>
    $mul?: Record<string, number>
    $pop?: Record<string, 1 | -1>
    $pull?: Record<string, any>
    $push?: Record<string, any>
    $unset?: Record<string, "">