Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda