Given the following documents in a table:
[
{
"id": "d30aa369-99d6-4a40-9547-2cbdf0bb069a",
"locations": [
{
"alerts": [
{"person": 200},
{"person": 300}
],
"name": "home"
},
{
"alerts": [
{"person": 200},
{"person": 300}
],
"name": "work"
}
],
"person": 100
},
{
"id": "d671d2c7-0e0d-43c0-9148-9e6b049b49a7",
"locations": [
{
"alerts": [
{"person": 100},
{"person": 300}
],
"name": "home"
},
{
"alerts": [
{"person": 100},
{"person": 300}
],
"name": "work"
}
],
"person": 200
}
]
I want to return all locations that have an alert containing a particular person. I thought it would go a little something like this:
r.db('db').table('test')('locations').filter(function(location){
return location('alerts')('person').eq(200);
});
Yet I get:
RqlRuntimeError: Cannot perform bracket on a sequence of sequences in:
What is the correct way to execute this query?