Answers for "update is running even if data is not present in dynamodb"

0

update is running even if data is not present in dynamodb

const params = {
    TableName: 'users',
    Key: {
        'userId': '123'
    },
    UpdateExpression: 'SET isActive = :isActiveVal',
    ConditionExpression: 'attribute_exists(userId)',
    ExpressionAttributeValues: {
        ':isActiveVal': 'false'
    },
    ReturnValues: "ALL_NEW"
};
Posted by: Guest on March-21-2021
0

update is running even if data is not present in dynamodb

var params = {
    TableName: 'users',
    Key: {
        'userId': '123'
    },
    UpdateExpression: 'SET isActive = :isActiveVal',
    ConditionExpression: 'userId = :userIdVal and isActive <> :isActiveVal',
    ExpressionAttributeValues: {
        ':userIdVal': '123',
        ':isActiveVal': 'false'
    },
    ReturnValues: "ALL_NEW"
};
Posted by: Guest on March-21-2021

Code answers related to "update is running even if data is not present in dynamodb"

Browse Popular Code Answers by Language