可以通过各种方式过滤文档 - 范围,嵌套值,布尔条件和匿名函数的结果。
说我有:
{
name: 'Joe'
orders: [
{
id: 123456,
date: '2016-01-19T09:12:48.898000+00:00'
}
]
}
我想检索订单中ID为123456的用户
每the docs,我尝试过使用...
(long list of things cut out, now I've found the actual answer)
但我没有结果。
答案 0 :(得分:3)
这也有效:
r.db('myapp').table('people').filter(function(person) {
return person('orders').map(function(order){
return order('id')
}).contains(123456)
})
答案 1 :(得分:0)
知道了:
r.db('myapp').table('people').filter(function(person){
return person("orders").contains(function (order) {
return order('id').eq(123456);
})
})