jcberquist / aws-cfml

Lucee/ColdFusion library for interacting with AWS API's
MIT License
72 stars 53 forks source link

Question: handling arbitrary JSON? #2

Closed aqlong closed 5 years ago

aqlong commented 8 years ago

We have JSON that can have a variety of arbitrary schemas, and it could change significantly over time. It seems, at least compared to MongoDB, that DynamoDB is not very good at handling arbitrary JSON formats, but is more suited for formats that you have complete control over. Would you agree?

Or do you have more samples of dealing with arbitrary JSON in various complex formats?

Thank you!

jcberquist commented 8 years ago

Hmm...I am not sure I follow. In terms of storing items, DynamoDB only enforces the existence and type of the Hash and Range (if defined) keys. I suppose any keys you included in an index would be subject to the same requirements. But other than that, you can put whatever you want in an item (subject to the supported data types, of course).

I think the JSON support of the official AWS SDK's involves mapping a JSON document to DynamoDB's own native data types, and then converting the same back to JSON when retrieved. So the equivalent for this repo would be to deserialize a JSON document for storage, and reserialize it when retrieved. Of course (unfortunately), this would be subject to ColdFusion's well known failings with serializeJSON()/deserializeJSON() But leaving that aside, there is no reason why you could not store arbitrary JSON documents in different items in the same table.