> ## Documentation Index
> Fetch the complete documentation index at: https://www.domo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Partially Update Documents

> Perform partial updates on documents using MongoDB query and update operations.
Returns the number of documents updated. Returns `0` if no documents matched — this is a successful response, not an error.
`$setOnInsert` has no effect because AppDB partial updates do not perform upserts.

**Supported update operators:** `currentDate`, `inc`, `min`, `max`, `mul`, `rename`, `set`, `unset`, `addToSet`, `pop`, `pull`, `pullAll`, `push`

**Supported modifiers:** `each`, `position`, `slice`, `sort`

See the [MongoDB Update Operators documentation](https://www.mongodb.com/docs/manual/reference/mql/update/) for details.




## OpenAPI

````yaml /openapi/product/appdb.yaml put /api/datastores/v2/collections/{collectionId}/documents/update
openapi: 3.0.0
info:
  title: App DB API
  version: v1
  description: |
    The App DB API allows developers to interact with AppDB, a NoSQL database 
    for storing arbitrary JSON documents. This API supports CRUD operations, 
    querying, and aggregation, enabling developers to manage data efficiently 
    within their Domo applications.
servers:
  - url: https://{instance}.domo.com
    description: Domo Instance
    variables:
      instance:
        default: api
        description: Your specific Domo instance name (e.g., mycompany)
security:
  - developerToken: []
tags:
  - name: Documents
    description: Manage individual documents in an AppDB collection.
  - name: Collections
    description: Manage AppDB collections (schema, permissions).
  - name: App DB API (Product)
    description: Manage documents and collections in AppDB.
paths:
  /api/datastores/v2/collections/{collectionId}/documents/update:
    put:
      tags:
        - App DB API (Product)
      summary: Partially Update Documents
      description: >
        Perform partial updates on documents using MongoDB query and update
        operations.

        Returns the number of documents updated. Returns `0` if no documents
        matched — this is a successful response, not an error.

        `$setOnInsert` has no effect because AppDB partial updates do not
        perform upserts.


        **Supported update operators:** `currentDate`, `inc`, `min`, `max`,
        `mul`, `rename`, `set`, `unset`, `addToSet`, `pop`, `pull`, `pullAll`,
        `push`


        **Supported modifiers:** `each`, `position`, `slice`, `sort`


        See the [MongoDB Update Operators
        documentation](https://www.mongodb.com/docs/manual/reference/mql/update/)
        for details.
      parameters:
        - name: collectionId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the collection.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
                - operation
              properties:
                query:
                  type: object
                  additionalProperties: true
                  description: MongoDB query that identifies the documents to update.
                operation:
                  type: object
                  additionalProperties: true
                  description: MongoDB update operation to apply.
            examples:
              set-field:
                summary: Set a field on matching documents
                value:
                  query:
                    content.status: Draft
                  operation:
                    $set:
                      content.status: Active
              increment-field:
                summary: Increment a numeric field
                value:
                  query:
                    content.views:
                      $exists: true
                  operation:
                    $inc:
                      content.views: 1
      responses:
        '200':
          description: Returns the number of updated documents or properties.
          content:
            application/json:
              schema:
                type: integer
                example: 1
        '400':
          description: >-
            Bad Request. The request body is missing a required field (`query`
            or `operation`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: query is required
                status: 400
                statusReason: Bad Request
                toe: 8PJRQYWMHF-NXB3Z-KTZUA
        '404':
          $ref: '#/components/responses/CollectionNotFound'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: A human-readable error message.
        status:
          type: integer
          description: HTTP status code.
        statusReason:
          type: string
          description: HTTP status reason phrase.
        toe:
          type: string
          description: Trace identifier for support; stands for Thread of Execution.
  responses:
    CollectionNotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: >-
              Cannot find permission from source [USER:870010733] to target
              [MAGNUM_COLLECTION:a3f7d891-bc24-4e56-9a12-c7e3b0f845d2].
              Permission Service reports that one or both does not exist
            status: 404
            statusReason: Not Found
            toe: RG3808D5LS-DHKE4-TG5EB
  securitySchemes:
    developerToken:
      type: apiKey
      in: header
      name: X-DOMO-Developer-Token
      description: Domo Developer Token for authentication.

````