Bird
0
0

Which of the following is the correct way to import the DynamoDB DocumentClient and ExpressionAttributeNames helper in JavaScript SDK v3?

easy📝 Syntax Q12 of 15
DynamoDB - with AWS SDK
Which of the following is the correct way to import the DynamoDB DocumentClient and ExpressionAttributeNames helper in JavaScript SDK v3?
Aimport { DynamoDBDocumentClient } from "aws-sdk";
Bimport { DynamoDBClient, ExpressionAttributeNames } from "@aws-sdk/client-dynamodb";
Cconst { DynamoDBClient, ExpressionAttributeNames } = require("aws-sdk");
Dimport { DynamoDBDocumentClient, ExpressionAttributeNames } from "@aws-sdk/lib-dynamodb";
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct SDK package for helpers

    Expression helpers like ExpressionAttributeNames are in "@aws-sdk/lib-dynamodb", not "@aws-sdk/client-dynamodb".
  2. Step 2: Correct import syntax for v3

    Use ES module import syntax with curly braces from "@aws-sdk/lib-dynamodb" for DocumentClient and helpers.
  3. Final Answer:

    import { DynamoDBDocumentClient, ExpressionAttributeNames } from "@aws-sdk/lib-dynamodb"; -> Option D
  4. Quick Check:

    Helpers come from lib-dynamodb package [OK]
Quick Trick: Helpers are in lib-dynamodb, not client-dynamodb [OK]
Common Mistakes:
MISTAKES
  • Importing helpers from client-dynamodb package
  • Using require() instead of import in v3
  • Importing from aws-sdk (v2) instead of @aws-sdk

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes