1
我想檢查一個表中的字段是否存在(大小寫敏感)使用Thinky ORM。如果沒有Thinky中,我可以比賽只是用簡單的RethinkDB過濾匹配操作的領域:如何在Thinky ORM中匹配字段?
// This makes my variable insensitive.
let myFieldInsensitive = '(?i)^' +myFieldSensitive`enter code here`+'$';
// Filter by matching myFieldInsensistive.
r.table('myTable').filter(r.row('myField').match(myFieldInsensitive))
.run(myConnection, function (err, result) {
console.log(result.length); // returns 1 if myFieldInsesitive was found
})
此代碼將檢查mySpecificField確實存在,但在myTable的(案例在 - 敏感)。
現在,我試圖做使用相同的比賽Thinky中,但這ORM不支持此語法:
let myFieldInsensitive = '(?i)^' +myFieldSensitive+'$';
myModel.filter(('myField').match(myFieldInsensitive)})
.run().then((result) => {
console.log(result.length); // should return 1 if myFieldInsesitive was found, but this returns always empty array
})
有誰大約有想法怎麼能比賽數據表中使用Thinky?
不錯,你得到它的工作。 :)考慮添加它作爲下面的答案,而不是評論。 – Tholle