Lucaci Sergiu Lucaci Sergiu - 3 months ago 10x
Node.js Question

How can you match a field in Thinky ORM?

I am trying check if one field from a table does exists (Case In-sensitive) using Thinky ORM. Without Thinky, I can match a field just using RethinkDB simple filter-match operations:

// This makes my variable insensitive.
let myFieldInsensitive = '(?i)^' +myFieldSensitive`enter code here`+'$';
// Filter by matching myFieldInsensistive.
.run(myConnection, function (err, result) {
console.log(result.length); // returns 1 if myFieldInsesitive was found

This code will check if the mySpecificField does exists yet in myTable (Case In-sensitive).

Now, I am trying to do the same match using Thinky, but this ORM does not support this syntax:

let myFieldInsensitive = '(?i)^' +myFieldSensitive+'$';
.run().then((result) => {
console.log(result.length); // should return 1 if myFieldInsesitive was found, but this returns always empty array

Does anybody has idea about how can you match data in a table using Thinky?


Finally did it! I have included thinky.r:

let r = thinky.r;

Instead of writing


I wrote