我有一个dynamodb表,其中"feed_guid"作为全局二级索引.我想查询该表中的一组feed_guid.由于"feed_guid"不是我的主键,所以我不能使用getBatchItem.当我尝试以下方法时,我收到此错误"KeyConditionExpression中使用的无效运算符:OR".
$options = array(
'TableName' => 'feed',
'IndexName' => 'GuidIndex',
'KeyConditionExpression' => 'feed_guid = :v_guid1 or feed_guid = :v_guid2',
'ExpressionAttributeValues' => array (
':v_guid1' => array('S' => '8a8106e48bdbe81bf88d611f4b2104b5'),
':v_guid2' => array('S' => '19cab76242a6d85717de64fe4f8acbd4')
),
'Select' => 'ALL_ATTRIBUTES',
);
$response = $dynamodbClient->query($options);
Run Code Online (Sandbox Code Playgroud) 我有一个具有以下项目结构的 AWS DynamoDb 购物车表 -
{
"cart_id": "5e4d0f9f-f08c-45ae-986a-f1b5ac7b7c13",
"user_id": 1234,
"type": "OTHER",
"currency": "INR",
"created_date": 132432423,
"expiry": 132432425,
"total_amount": 90000,
"total_quantity": 2,
"items": [
{
"amount": 90000,
"category": "Laptops",
"name": "Apple MacBook Pro",
"quantity": 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
——
{
"cart_id": "12340f9f-f08c-45ae-986a-f1b5ac7b1234",
"user_id": 1234,
"type": "SPECIAL",
"currency": "INR",
"created_date": 132432423,
"expiry": 132432425,
"total_amount": 1000,
"total_quantity": 2,
"items": [
{
"amount": 1000,
"category": "Special",
"name": "Special Item",
"quantity": 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
该表将cart_id作为主键、
user_id作为索引或 GSI、
type作为索引或 GSI。 …