Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

executeUpdateExpression matches key attibutes with variable name in Model Class instead of @rangeKey({attributeName: '<>'}) #197

@krishmakochhar

Description

@krishmakochhar

If your model is like this :

export class Model {
    @hashKey({attributeName: 'HashKey'})
    private _hashKey!: string;

    @rangeKey({attributeName: 'SortKey'})
    private _sortKey!: string;

And if I try to use the executeUpdateExpression method as :

const itemKey = {
            HashKey: <some-key>,
            SortKey: <some-key>,
        };
        await this.mapper.executeUpdateExpression(updateExpression, itemKey, noArgsConstructor);

We get “The provided key element does not match the schema” error. But it works fine if use this instead :

const itemKey = {
            _hashKey: <some-key>,
            _sortKey: <some-key>,
        };
        await this.mapper.executeUpdateExpression(updateExpression, itemKey, noArgsConstructor);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions