Lucaci Sergiu Lucaci Sergiu - 1 year ago 87
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?

Answer Source

Finally did it! I have included thinky.r:

let r = thinky.r;

Instead of writing


I wrote



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download