Closed mjmarianetti closed 6 years ago
@mjmarianetti - this doesn't currently handle objects as values. I'm not 100% sure how DynamoDB calculates the size in this situation, but I think we should figure this out and get it added. Have you solved this yourself? Would you be up to making a PR to fix this?
@mcwhittemore I solved it doing JSON.stringify in the element. I tried converting it to an array and it ouputs the same size.
let element = JSON.stringify(item); dynoItemSize(element).
If you can confirm that this is the way it has to be done, I'll do it.
The AWSSDK converts { name: 'newcastle', score: '10' }
into { M: { name: { S: 'newcastle' }, score: { S: '10' } } }
so the base of figuing out the size of an object is to call dynoItemSize when an object is found. That said, I'd guess the size cost of an object is more than the sum of its parts. I've yet to find documentation that explains this.
This should be fixed now and part of 0.3.0 on npm.
Hi, I am trying to use this package with the following item structure:
var item = { // properties, subitems: { id1: { // properties }, id2: { // properties } } }
it is returning NaN for size, read and write. I guess it have a problem with this type of object