Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
Using AWS-SDK for DynamoDB, createSet creates a Map instead of a Set

If you were to create a new item and leave an empty list (i.e { a: 'string', b: [] } in your params, it'll convert this to a List Attribute. What I actually want is a String Set Attribute, or SS.

I scoured through the documentation more and found createSet and was hopeful this will solve my problem. But unfortunately it created a Map Attribute instead. Currently, this is how I'm creating it:

const aws = require('aws-sdk');

(async () => {
    const docClient = new aws.DynamoDB.DocumentClient();

    const params = {
        TableName: 'some_table_in_dynamodb',
        Item: {
            a: 'some string',
            b: docClient.createSet([])
        }
    };

    const response = await docClient.put(params).promise();
    console.log(response);
})();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got the solution from playing with the UI on DynamoDB: The list CANNOT be empty, otherwise it'll convert it to a Map attribute. to fix this, just add an empty string.

const aws = require('aws-sdk');

(async () => {
    const docClient = new aws.DynamoDB.DocumentClient();

    const params = {
        TableName: 'some_table_in_dynamodb',
        Item: {
            a: 'some string',
            b: docClient.createSet(['']) // ADD STRING FOR SS ATTRIBUTE
        }
    };

    const response = await docClient.put(params).promise();
    console.log(response);
})();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!