在dynamodb中使用nodejs在列表内search

我正在做一个项目,我们正在使用Dynamodb作为数据库,我有一个这样的结构的文档:

{ "shop_id": "hh-delightme", "shoppers": [ { "email": "hatim.haffane@gmail.com", "name": "hatim haffane" }, { "email": "xxx.zzz@gmail.com", "name": "bxdsf sdf sd f" } ] },{ "shop_id": "it-delightme", "shoppers": [ { "email": "hatim.haffane@gmail.com", "name": "hatim haffane" }, { "email": "xxx.zzz@gmail.com", "name": "bxdsf sdf sd f" } ] } 

我有两个索引shop-id-index和email-index,所以我想要做的是在shop_id“hh-delightme”中得到带有“hatim.haffane@gmail.com”

我试过这个代码,但没有成功

 var params = { TableName:"shopper", KeyConditionExpression:"shop_id = :shop_id AND email = :email", ExpressionAttributeValues: { ":shop_id":store, ":email":email } }; docClient.query(params, function(err, data) {} 

任何人都可以帮我完成这个工作,谢谢

我相信你不能同时查询两个索引。 您可以将您的查询更改为扫描 – 但是这样做会比较慢,因为它会扫描每个查询的整个表格 – 或者您只能查询其中一个索引。 我会查询您认为会返回最低数量的结果的索引,可能是电子邮件,然后通过shop_id筛选您的nodejs代码中的结果。