2016-12-20 11 views

答えて

0

DynamoDBで利用可能な直接の同等物はありません。ただし、回避策の1つは、記述テーブルAPIを使用してItemCountを取得することです。 ITEMCOUNT個の

欠点: -

DynamoDBのは約6時間ごとにこの値を更新します。最近の の変更がこの値に反映されないことがあります。

地元DynamoDBのインスタンスから作品テーブルの項目数を取得するためのコード: -

'use strict'; 
var dynamoose = require('dynamoose'); 
dynamoose.AWS.config.update({ 
    accessKeyId : 'AKID', 
    secretAccessKey : 'SECRET', 
    region : 'us-east-1' 
}); 
dynamoose.local(); 

var Schema = dynamoose.Schema; 
var Table = dynamoose.Table; 

var table = new Table('Movies', null, null, dynamoose); 

table.describe(function(err, data) { 
    if (err) { 
     console.log(JSON.stringify(err)); 

    } else { 
     console.log(JSON.stringify(data, null, 2)); 
     console.log("Number of item =====>", JSON.stringify(data.Table.ItemCount, null, 2)); 
    } 
}); 

出力: -

Number of item =====> 24 
関連する問題