Math And Logic¶
mod¶
get the modulus of 2 numbers
r.table("heros").filter(r.lambda(x.field("age").mod(2))).run(con); // get the even ages
and¶
Create an and clause.
r.table("heros").filter(row->
r.and(
row.field("name").eq("Adam")
row.field("id").eq(1)
)
).run(con);
or¶
Create an or clause.
r.table("heros").filter(row->
r.and(
row.field("name").eq("Adam")
row.field("name").eq("Eve")
)
).run(con);
eq¶
Specifiy an equals condition
r.table("heros").filter(row-> row.field("name").eq("John")).run(con); // All the Johns
ne¶
Specifiy a not equal condition
r.table("heros").filter(row-> row.field("name").ne("John")).run(con); // everyone but John
gt¶
Specifiy a greater than condition
r.table("heros").filter(row-> row.field("age").gt(10)).run(con); // everyone older than 10
ge¶
Specifiy a greater than or equal condition
r.table("heros").filter(row-> row.field("age").ge(10)).run(con); // everyone older than or equal to 10
lt¶
Specifiy a less than condition
r.table("heros").filter(row-> row.field("age").lt(10)).run(con); // everyone younger than 10
le¶
Specifiy a less than or equal condition
r.table("heros").filter(row-> row.field("age").le(10)).run(con); // everyone younger than or equal to 10
not¶
Compute the logical inverse (not).