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

548
Vistas
In DymanoDB/Dynamoose, how can I set a schema of a map of string keys and number values?

So I have this instructions:

Schema Defs: Result object: It's a map of string keys and number values

"result": { "M": { [STRING]: { "N": "401" } },

This is what I have so far

  result: {
    type: Object,
    schema: {
      // I am getting 2 errors:
      // Parsing error: Unexpected token, expected "]"
      // ',' expected.
      [id: String]: Number
    },
    required: true
  },

Any ideas?

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

0

[id: String] is a TypeScript thing. Not allowed in standard JavaScript.

This is not technically possible in Dynamoose. The only option here is to use the saveUnknown schema setting.

This was brought up in a conversation before, and the user who wanted to do this I told to create an issue on the GitHub repo but it doesn't look like that happened. If you'd like support for this in Dynamoose in the future, please submit a feature request on the GitHub repo.


Edit

In order to do this your schema would looks something like:

new dynamoose.Schema({
  result: {
    type: Object,
    required: true
  },
}, {
  "saveUnknown": ["result.**"]
});

This will allow indefinitely nested objects within result.

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