ODBC Driver for MongoDB

Build 25.0.9434

UpdateScheme

Specifies the strategy that can be used when executing an update statement.

Possible Values

Default, Merge

Data Type

string

Default Value

"Default"

Remarks

When updating a target document with fields that are replaced or merged, an update statement is executed. If the default value is set to Default, the driver replaces the entire original document with a new one. However, if the value is set to Merge, only specific fields in the target document can be updated.

This property helps trigger the system to identify which document needs modifications.

For example, if you have a collection 'classySample' as below.

{
  "_id": "1",
  "message": {
    "component_items": [{"locked": true}],
    "id":1
  }
}

UPDATE [classySample] SET [message.component_items.0.locked] = false  WHERE [message.id] = 1

In the query above, the 'message' document will be replaced with new document constructed with SET clause, the collection after updating looks like

{
  "_id": "1",
  "message": {
    "component_items": [
      {
        "locked": false
      }
    ]
  }
}

But when using Merge, only the 'locked' field in 'component_items' will be updated, the collection becomes

{
    "_id": "1",
    "message": {
        "component_items": [
            {
                "locked": false
            }
        ],
        "id": 1
    }
}

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434