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

258
Views
Why is putting an object in local dynamodb table changing some field of the said object?

This is an extremely weird one. I'm using datamapper for dynamo and dynamolocal in typescript to test my stuff. For some reason it overwrites one object field and I can't figure out why.

I'm seeding the table like so:

private async seedTable() {
        // FIRST PART
        for (const obj of [...objects]) {
            const toSave = new MyObject().fromPartial({
                ...obj
            });
            console.log(`myBool: ${toSave.myBool}`);
            await this.ddbMapper.put(toSave);
        }

        // SECOND PART
        await this.ddbMapper.put(
            new MyObject().fromPartial({
                ...objects[0],
                objId: "test",
                myBool: false
            })
        );
    }

In this previous snippet, the objects from the for loop will print: "myBool: false"

however in the table they will be true (what?)

the second part where I hardcode the object, it's getting saved with myBool: false as I would expect

If I overwrite the value it works but if I keep the original object it switches to true for no apparent reason.

this is the fromPartial implementation

public fromPartial(data: Partial<MyObject>): MyObject {
        Object.assign(this, data);
        return this;
    }

is this a bug from dynamodb / dynamodb-local / my implementation / javascript / typescript ? does anybody have a clue into what could be the source of the issue ?

Edit: ddbmapper is the DataMapper class from dynamodb-data-mapper

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ok found the issue, actually the value was "false" instead of false which the mapper seems to force at runtime so the string evaluates to true. Kind of a weird behaviour when you know that passing an object with correct properties but no type does not work with datamapper : the github issue I'm talking about issue

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!