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

262
Vistas
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 Respuestas
Responde la pregunta

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