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

173
Vistas
How to pass primary key value to DynamoDB?

I have a nodejs app and I am using putItem() to insert into DynamoDB. The table that I am passing the value to has a primary key called "id". Now what I am trying to do is to generate a UUID and set the primary key value to that UUID whenever I insert the data. However when I insert, the "id" is inserted with double quotes. For eg: instead of id: 229f0a06-7257-4727-b825-a6e8ea343b1e it will show as id : "229f0a06-7257-4727-b825-a6e8ea343b1e". I checked the schema and it shows that "id" KeyType is HASH. This is the code I have to insert into DB:

let data = {};
 data.id= uuidv4(); //Trying to set the primary key "id"
 data.name = "Test";
 
 const dynamoDB = new DynamoDBClient;
 const result = await dynamoDB.putItem(data);

When I go check in the DB table, it shows id : "229f0a06-7257-4727-b825-a6e8ea343b1e". How can I set the "id" so that it doesn't show up with double-quotes?

Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

How can I set the "id" so that it doesn't show up with double-quotes?

You don't want to. Your Partition Key (= Hash Key) data type is String, which of course is the right data type for UUIDs.

Hash Key is a DynamoDB synonym for Partition Key. As such, HASH in the CreateTable KeySchema API is not a data type, but rather is a reference to the Partition Key field. The docs continue, "the attributes in KeySchema must also be defined in the AttributeDefinitions", to a data type to one of (S)tring, (N)umber or (B)inary.

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