dynamodb-onetable: [BUG]: Unable to use `begins` condition with `Model.find` in TypeScript
Describe the bug
It is unclear how to properly use a begins
condition when using the Model.find
APIs.
This results in a compile error:
export const getEventsByDriverId = async (driverId: string, filter?: Filter): Promise<AWSEvent[]> => {
const sk = { begins: { sk: buildPrefix(filter) } }
const results = await EventModel.find({ driverId, sk }, { tunnel, index: 'gs2' })
return results as AWSEvent[]
}
This results in .for is not iterable
error.
export const getEventsByDriverId = async (driverId: string, filter?: Filter): Promise<AWSEvent[]> => {
const tunnel = { begins: { sk: buildPrefix(filter) } }
const results = await EventModel.find({ driverId }, { tunnel, index: 'gs2' })
return results as AWSEvent[]
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26 (26 by maintainers)
The log: true reveals ALL 😉
looks like it worked! appreciate it!
awesome. thanks!