Este tópico descreve como atualizar as configurações de tabela com o Tablestore SDK for Node.js.
Pré-requisitos
Descrição do método
updateTable: function describeTable(params, callback)
Nota
Ao chamar o método
updateTable(), defina tableOptions.Ao configurar tableOptions, especifique pelo menos um dos seguintes parâmetros: timeToLive, maxVersions, maxTimeDeviation ou allowUpdate.
Código de exemplo
O código de exemplo a seguir demonstra como modificar as configurações da tabela test_table.
var params = {
tableName: 'test_table',
tableOptions: {
// Set the TTL to 86400 seconds
timeToLive: 86400,
// Set the maximum number of versions
maxVersions: 3,
// Set the maximum version offset to 86400 seconds
maxTimeDeviation: 86400,
// Specify whether to allow updates
allowUpdate: false
},
// Set the reserved read throughput to 0 CUs and the reserved write throughput to 0 CUs (Only high-performance instances in CU mode support setting non-zero values for reserved read and write throughput)
reservedThroughput: {
capacityUnit: {
read: 0,
write: 0
}
},
// Enable Stream and set the Stream expiration time to 7 days
streamSpecification: {
enableStream: true,
expirationTime: 168
}
};
client.updateTable(params, function (err, data) {
if (err) {
console.error('error:', err);
return;
}
console.log('success:', data);
});