I'm using @aws/dynamodb-expressions package to retrieve the data from the dynamodb with the combination of AND, OR, EQUALS expression conditions. However I'm getting "ValidationException: Invalid operator used in KeyConditionExpression: OR" error.

let key: AndExpression = {
      type: "And",
      conditions: [
        {
          type: "Or",
          conditions: [
            { subject: COLUMN1, ...equals(id) },
            { subject: COLUMN2, ...equals(id) }
          ]
        }
      ]
    };

if (some_condition) {
      key.conditions.push({
        subject: COLUMN3,
        ...between(startDate, endDate)
      });
    }

I want to get the all the records with id matching either COLUMN1 or COLUMN2.

ERROR: "ValidationException: Invalid operator used in KeyConditionExpression: OR"

0 Answers