I have a key in dynamo that has two Global Secondary Indexes with different range keys. Like this:
const productSchema = new Schema(
{
productCategory: {
type: String,
index: [{
global: true,
rangeKey: 'serialNumberEnd',
name: 'productCategory',
throughput: { read: 1, write: 1 },
project: ['quantity'],
},
{
global: true,
rangeKey: 'orderType',
name: 'openOrders',
throughput: { read: 1, write: 1 },
project: true,
}],
},
{
throughput: { read: 1, write: 1 },
useNativeBooleans: true,
saveUnknown: true,
},
);`
Trying to use the 'name' does not seem to be the answer.
Resource.query('openOrder').eq(id)
How am I supposed to distinguish between the two GSI's on the same Key in a resource when constructing a query?
EDIT - Added additional context to the schema, moved answer to the answer section