Closed john-aws closed 6 years ago
The documented way to get these attributes would be Items[0].get('id')
for example, which is shown throughout almost all of the documentation.
Thanks, that's helpful. I didn't find get() in any of the query or scan examples in the readme. I also did not find any reference documentation for Model. Appreciate the quick response, thanks.
I agree. Honestly, we could do with some proper API documentation instead of just a readme with examples.
If you call query() on a table, you get back an object whose
Items
property, when printed with JSON.stringify, appears to be an array of items that looks like this:It would seem reasonable to the dynogels newcomer to access properties of the retrieved items using
Items[0].id
orItems[0].name
. Both of these yield 'undefined', however.Nowhere, that I can see, is it documented that what you actually have here are instances of 'Model' and that you access the properties via an intermediate 'attr' property, for example
Items[0].attr.id
andItems[0].attr.name
.Small change, but I think it would help make dynogels easier to use for newcomers. Thanks.