如何通过发电机中的数组中的元素过滤
我发电机模式如下。
var dynamoose = require('dynamoose');
var City = dynamoose.model('City', { id: Number, name: String });
和城市名称数据,例如'city1','city2',...'city100'
我正在尝试获取城市名称为'code>'city2','city8'我没有找到
我尝试过的任何解决方案,在下面
Model.scan({ name: { contains: 'City2' } }).exec();
如何添加city8
也
note :name
列没有任何索引
I've dynamoose schema like below.
var dynamoose = require('dynamoose');
var City = dynamoose.model('City', { id: Number, name: String });
and City names data like 'City1', 'City2',...'City100'
I'm trying to get the cities whose city names are 'City2', 'City8'
and i didn't find any solution
i tried like below
Model.scan({ name: { contains: 'City2' } }).exec();
How to add City8
also
Note: name
column doesn't have any index
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我看到您正在使用扫描。我会使用查询,因为它更具性能和更多。
查询可以是:
问候!
I see that you are using scan. I would use query as it's more performant and more.
The query can be something like:
Regards!
我将使用
name
作为hashkey创建一个新索引,并使用.getBatch
函数。它需要一系列ID(我相信50个ID是尺寸限制)。I would create a new index with
name
as hashkey and use.getBatch
function. It takes an array of ids (I believe 50 ids is the size limit).