dynamodb-按数组中的值扫描项目 [英] dynamodb - scan items by value inside array

查看:117
本文介绍了dynamodb-按数组中的值扫描项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行表格扫描。该表具有一个数组作为其字段之一,即 apps字段(apps不是任何键)。我想选择所有行,其应用程序数组包含某个值 MyApp。我尝试了这种方法,但是我的语法不正确:

I'm doing a table scan. This table has an array as one of its fields, the "apps" field (apps is not a key of any kind). I want to select all rows, whose apps array contains a certain value "MyApp". I tried something of that kind, but my syntax is incorrect:

    ComparisonOperator = "#apps CONTAINS :v",
    ExpressionAttributeNames = {
        '#apps': 'apps'
    },
    ExpressionAttributeValues = {
        ":v": "MyApp"
    }

谢谢。

推荐答案

关于条件表达式的文档明确指出适当的语法是:

The documentation about Condition Expressions clearly states that the appropiate syntax is:

contains(#apps, :v)

正确的请求将是:

FilterExpression: "contains(#apps, :v)",
ExpressionAttributeNames: { "#apps": "apps" },
ExpressionAttributeValues: { ":v": "MyApp" }

这篇关于dynamodb-按数组中的值扫描项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆