Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NULL converted to 0 when fetching data #514

Closed
lucas-subli opened this issue Apr 19, 2023 · 1 comment · Fixed by #521
Closed

NULL converted to 0 when fetching data #514

lucas-subli opened this issue Apr 19, 2023 · 1 comment · Fixed by #521

Comments

@lucas-subli
Copy link
Contributor

lucas-subli commented Apr 19, 2023

My table is configured to NOT remove null attributes

removeNullAttributes: false,

I have two attributes defined as

attr1: { type: 'number' },
attr2: { type: 'string' },

Saved them both as null, checking on Dynamo as expected, we have:

"attr1": {
    "NULL": true
  },
"attr2": {
    "NULL": true
  },

However, when getting the item back from Dynamo, I get

attr1: 0,
attr2: null,

I don´t see why any conversion took place for the number
But even if a conversion (null to 0) were to take place, it should have also taken place when saving the data to dynamoDB and saved 0, not NULL.

@lucas-subli lucas-subli changed the title Number conversion not working both ways on NULL NULL being converted to 0 when fetching data Apr 19, 2023
@lucas-subli lucas-subli changed the title NULL being converted to 0 when fetching data NULL converted to 0 when fetching data Apr 19, 2023
@naorpeled
Copy link
Collaborator

My table is configured to NOT remove null attributes

removeNullAttributes: false,

I have two attributes defined as

attr1: { type: 'number' },
attr2: { type: 'string' },

Saved them both as null, checking on Dynamo as expected, we have:

"attr1": {
    "NULL": true
  },
"attr2": {
    "NULL": true
  },

However, when getting the item back from Dynamo, I get

attr1: 0,
attr2: null,

I don´t see why any conversion took place for the number But even if a conversion (null to 0) were to take place, it should have also taken place when saving the data to dynamoDB and saved 0, not NULL.

Hey @lucas-subli,
taking a look now 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants