How do I define a subdocument for an `sst.Table`? ...
# sst
j
How do I define a subdocument for an
sst.Table
? This is what I'm trying but it errors with
Type '{ ticketId: TableFieldType.STRING; ticketType: TableFieldType.STRING; startDate: TableFieldType.STRING; endDate: TableFieldType.STRING; cost: TableFieldType.NUMBER; }[]' is not assignable to type 'TableFieldType'
Copy code
this.tables.cards = new sst.Table(this, "Cards", {
      fields: {
        accountId: sst.TableFieldType.STRING,
        cardId: sst.TableFieldType.STRING,
        tickets: [{
          ticketId: sst.TableFieldType.STRING,
          ticketType: sst.TableFieldType.STRING,
          startDate: sst.TableFieldType.STRING,
          endDate: sst.TableFieldType.STRING,
          cost: sst.TableFieldType.NUMBER,
        }]
      },
      primaryIndex: { partitionKey: "accountId", sortKey: "cardId" },
    })
g
You only define the types of the indexes. Dynamo is schema-less for everything else.
j
Doh!