How to query data without knowing PK Key using electrodb on dynamodb

23 views Asked by At

I am using electrodb to get data's from dynamodb.

I am trying to get data's without knowing pk values (brand) and only with sk value (type) , by example, to get all car with type = type.

Is it possible because i can't figure out how ?

here is my entity indexes :

indexes: {
      byCar: {
        pk: {
          field: PK,
          composite: ['brand'],
          template: '${brand}',
        },
        sk: {
          field: SK,
          composite: ['type'],
          template: '${type}',
        },
      },
    },
  },
1

There are 1 answers

0
Leeroy Hannigan On

I've never heard of ElectroDB but this is how the syntax should look based on the docs you link:

await StoreLocations.query
  .byCar({
    brand: "someBrand"
  })
  .go();