dynamodb-toolbox: Query and Scan do not parse `sets`.

We have noticed that while using the functions scan and query any set attributes do not seem to be parsed correctly. They come back as a DynamoDBSet and not as a list. However, when we use the get function, all the attributes that are returned appear to have been parsed correctly (including sets).

Is this by design? Perhaps I missed a setting. Any advice would be greatly appreciated.

Get result:

{ id: 'id', someSet: [ 'one', 'two' ] }

Scan and Query result:

{ id: 'id', someSet: [Set] }

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 14
  • Comments: 26 (15 by maintainers)

Most upvoted comments

At the moment what you can do is add the entity name (_et by default) field with the entity name and it would be parsed properly, just make sure to map the specific set field’s type to set.

@naorpeled Just so I understand - we would have to rewrite all our millions of dynamodb records to accomplish this, correct?

I would be great if there was a way to tell dynamodb-toolbox to “parse all responses as a certain entity”. Maybe this is a separate option that is passed in?

Edit: Maybe a parseAs option?

Unfortunately with the current implementation that is correct.

Will discuss this with @jeremydaly and see what fits best for this scenario.

More than a year and no reaction for this issue, so disappointing 😦

This works great now! Thank you for the fix!

@simlu I’m working on it now, will open a PR asap!

@naorpeled This is exactly what I needed thank you for all the help.

@naorpeled - can you take a look at this?

Sure!