Hello i need somehow to pass the filter method 2 or more arguments.
Something like r.table("N/A").filter(function(arg1,arg2){..code here})
I need it for the following:
I have a data structure like the following:
"client":{
"name":"andrew",
"coords":{"lat":200,"long":300}
}
I want to get a list of all clients , and for each client in this list i want his properties merged with the other clients that respect a filter predicate.I need to pass multiple arguments to filter function.
clients{
client:{
"name":"andrew",
"coords":{"lat":200,"long":300}
"neighbours":{
"name":"Dean","coords":{"lat":100,"long":200}
"name":"Sean","coords":{"lat":55,"long":120}
}
client:{
"name":"Dean",
"coords":{"lat":100,"long":200}
"neighbours":{
"name":"Sean","coords":{"lat":55,"long":120}
}
client:{
"name":"Sean",
"coords":{"lat":100,"long":200}
"neighbours":{}
}
}
My failed attempt:
r.db("cldb").table("clt").pluck(
{"name","coord"}).merge(function(currentClient){
return {
r.db("cldb").table("clt").filter(
function(currentClient,neighbourClient){
currentClient("lat").gt(neighbourClient("lat"))
.and(currentClient("long").gt(neighbourClient("long")))}
)}
})