我尝试使用嵌套数组来完成DynamoDB扫描,我尝试根据嵌套数组中的调查ID获取用户详细信息,我的表值如下所示。
{
"id": "28009dd8-5802-20f5-c7c9-af53e710ac91",
"user": {
"address1": "1, Park avenue",
"address2": "Austin",
"birthDate": "1999-01-01",
"city": "Austin",
"contact": "9876543210",
"country": "1",
"email": "rajmohan@gm.com",
"emgContact": "2",
"empStatus": "1",
"ethnicity": "5",
"firstName": "Rajmohan",
"gender": "male",
"highLevelEduc": "2",
"image": "",
"lName": "V",
"mName": "",
"nationality": "1",
"relationalStatus": "1",
"state": "43",
"telephone": "9876543210",
"zipCode": "70031"
},
"survey": [
{
"id": "e8de014a-22c1-12bf-4653-577c8031138",
"email": "rajmohan@gm.com",
"method": [
"email"
],
"name": "Rajmohan",
"onDemand": "yes",
"pollSchedule": "None",
"pollTarget": "Educator",
"telephone": "963696369",
"user_id": "413ca05f-ed91-50e7-1974-3e0280ca4a3d"
},
{
"id": "5f4db059-c8a3-e673-iygk-d857425e1077",
"created_at": 1674459043374,
"email": "test@gmail.com",
"method": [
"email"
],
"name": "New testing",
"onDemand": "yes",
"pollSchedule": "None",
"pollTarget": "Educator",
"telephone": "963696369",
"user_id": "413ca05f-ed91-50e7-2635-3e0280ca4a3d"
}
],
"summary": "test",
"user": "413ca05f-ed91-8k8y-2635-3e0280ca4a3d"
}
我的扫描语法是这样的。
var param = {
TableName: 'user',
FilterExpression: 'contains(#survey.#id,:id)',
ExpressionAttributeNames: {
'#survey': 'survey',
'#id':'id'
},
ExpressionAttributeValues: {
':id': id
},
}
但是我不能得到价值,我的观点是基于我需要得到用户价值的调查id。
1条答案
按热度按时间41zrol4v1#
你不能做你所尝试的,你需要传入Map的全部值,这将是相当困难的,我敢肯定。
使用Map列表
当使用
contains
函数时,您需要知道整个map值,因为您询问的是map是否包含在列表中,而不是map中是否包含字符串:使用嵌套贴图
你应该把你的列表组织成一个Map:
一个二个一个一个