LoginSignup
0
0

More than 1 year has passed since last update.

NodejsでDynamoDB使ってみた

Posted at

背景

はじめて業務でDynamoDBを使用したため、基本的なものだがメモを残して、自身のナレッジとして蓄えようかと

環境

  • node.js
  • DynamoDB
  • Lambda

経験した関数

登録

  • put

パラメータ

  • TableName: テーブル名
  • Item: 登録対象
ex))
TableName: 'test-table',
Item: {
  'id': 1,
  'name': 'test',
}

取得

  • get

パラメータ

  • TableName: テーブル名
  • Key: AttributeValueのカラム名(一般的なTableのprimary key)
ex))
TableName: 'test-table',
Key: {
  'id': 1
  'sort': 1
}

検索

  • scan

パラメータ

  • TableName: テーブル名
  • FilterExpression: SQLの条件式
  • ExpressionAttributeValues: SQLの条件式に設定する値
ex))
TableName: 'test-table',
FilterExpression: 'created_at = :now',
ExpressionAttributeValues: {
  ':now': '2021-01-01 00:00:00'
}

削除

  • delete

パラメータ

  • TableName: テーブル名
  • Key: AttributeValueのカラム名(一般的なTableのprimary key)
ex))
TableName: 'test-table',
Key: {
  'id': 1
}

ハマったこと

今後のチャレンジ

  • 参考リンクに他の関数もあったので、使ってみようかな

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0