我有视频模型:
module.exports = {
attributes: {
id: 'string',
tags: 'array'
},
}
我想找到所有带有标签的视频,例如“Hello”或“World”。 我可以轻松获取所有视频,例如: Video.find({tags:"Hello"}).我看到了搜索 id: [1,2,3] 但不是当 key(id => tags) 是数组时的示例。
最佳答案
将“in”-Statement 与“contains”结合使用
Video.find({tags: { contains: ["some1","some2"]}}).exec(function(err,res){
console.log(res);
});
参见:https://github.com/balderdashy/waterline-docs/blob/master/queries/query-language.md
关于javascript - 水线,在数组中查找数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24166253/