存在しないのであれば、これは簡単であるべきまたはStringSetを作成...追加それは
私はそれはdoesnの場合、それが存在する場合、DynamoDBの中StringSetに文字列を追加、またはStringSetプロパティを作成したいです値を設定します。空の配列を使用して作成時にStringSetを初期化することができれば、うまくいくでしょうが、できません。
は、ここで私がこれまで持っているものです。
const companiesTable = 'companies';
dynamodb.updateItem({
TableName: companiesTable,
Key: {
id: {
S: company.id
}
},
UpdateExpression: 'ADD socialAccounts = list_append(socialAccount, :socialAccountId)',
ExpressionAttributeValues: {
':socialAccountId': {
'S': [socialAccountId]
}
},
ReturnValues: "ALL_NEW"
}, function(err, companyData) {
if (err) return cb({ error: true, message: err });
const response = {
error: false,
message: 'Social account created',
socialAccountData
};
cb(response);
});
私も...
UpdateExpression: 'SET socialAccounts = list_append(socialAccounts, :socialAccountId)',
ExpressionAttributeValues: {
':socialAccountId': {
S: socialAccountId
}
},
と...
UpdateExpression: 'ADD socialAccounts = :socialAccountId',
ExpressionAttributeValues: {
':socialAccountId': {
S: socialAccountId
}
},
と...
を試してみましたUpdateExpression: 'SET socialAccounts = [:socialAccountId]',
ExpressionAttributeValues: {
':socialAccountId': socialAccountId
},
上記の他のすべての変動についてのうち、
と...
UpdateExpression: 'ADD socialAccounts = :socialAccountId',
ExpressionAttributeValues: {
':socialAccountId': socialAccountId
},
。私は愚かですか? DynamoDBはアレイタイプフィールドへの単純な書き込み/更新ができませんか?空の配列でそのフィールドをインスタンス化することができないので、フィールドを追加または設定しようとする前に、フィールドを最初に参照する必要がありますか?
パーフェクト見つけることができ、これは私の問題を解決しました! –