Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda