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

542
Views
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 answers
Answer question

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 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!