在云数据库中查询的时候,能不能查找字段等于一个数组中任意值的记录?

发布于 7 年前作者 weidai5603 次浏览最后编辑 7 年前来自 issues

就像有一个集合,所有记录都有字段A,A可能是任意值,现在一个数组B[1,2,3,4],想查找A等于这个数组中的值(1或2或3或4)的记录,要怎么写啊

1 回复
juan62
juan621 楼5 年前
db.collection('todos').where({
A: _.in([1,2,3,4])
})
.get()

https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/command/Command.in.html