stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
14 stars 16 forks source link

table update, wrong dataType for set operation, get 500 error #1749

Open Yuqi-Du opened 20 hours ago

Yuqi-Du commented 20 hours ago

Table

REATE TABLE filter.animal ( id text, name text, age int, height smallint, description text, PRIMARY KEY ((id, name), age, height)

Update

{
    "updateOne": {
        "filter": {
            "id": "1",
            "name": "dqy",
            "age": 1,
            "height": 2
        },
        "update": {
            "$set": {
                "description": 123
            }
        }
    }
}

response

{
    "errors": [
        {
            "message": "Server failed: root cause: (java.lang.RuntimeException) io.stargate.sgv2.jsonapi.exception.checked.ToCQLCodecException: Error trying to convert to targetCQLType `TEXT` from value.class `java.lang.Long`, value 123. Root cause: no codec matching value type",
            "errorCode": "SERVER_UNHANDLED_ERROR",
            "id": "ff27c5d5-8814-450a-bdf7-1ca5279e9d07",
            "family": "SERVER",
            "title": "Server failed",
            "scope": "DATABASE"
        }
    ]
}