awslabs / dynamodb-data-mapper-js

A schema-based data mapper for Amazon DynamoDB.
https://awslabs.github.io/dynamodb-data-mapper-js/
Apache License 2.0
817 stars 106 forks source link

why not scan or query return an array ? #185

Open happy-little-one opened 4 years ago

happy-little-one commented 4 years ago

I hope it can return a Promise,iterator is a trouble to me, now I have to code like this:

const dbScan = async () => {
  const arr = []
  for await (const item of mapper.scan(Category, { limit: 2 })) {
    arr.push(item)
  }
  return arr
}

I can not image a business scenario that need to be an Iterator.