Skip to main content

Batch Update Documents

PATCH 

/collections/:collectionName/documents

Update documents matching the query conditions. Supports MongoDB update operators (e.g. $set, $inc, $push, etc.).

When replaceMode is false (default) and data does not contain update operators, it will be automatically wrapped with $set.

Modifying _openid and _id fields is not allowed.

Request

Path Parameters

    collectionName stringrequired

    Collection name

Body

required
    query objectrequired

    Query conditions (EJSON object)

    data objectrequired

    Update data (EJSON object), supports update operators

    multi boolean

    Whether to update multiple documents

    upsert boolean

    Whether to create if not exists

    replaceMode boolean

    Whether to replace the entire document (true = replace, false = merge update)

    transactionId string

    Transaction ID

Responses

Update successful

Schema
    updated integer

    Number of updated documents

    matched integer

    Number of matched documents

    upsert_id string

    ID of the upserted document (if any)

Loading...