Javascript 当数据为json时,如何使用knex比较或过滤数据
当数据是json时,如何使用where过滤数据 我的桌子 还有我的密码Javascript 当数据为json时,如何使用knex比较或过滤数据,javascript,node.js,knex.js,Javascript,Node.js,Knex.js,当数据是json时,如何使用where过滤数据 我的桌子 还有我的密码 knex('companies') .join('company_integrations', 'companies.id', '=', 'company_integrations.company_id') .select('companies.id as id', 'companies.uuid as uuid', 'company_integrations.method as metho
knex('companies')
.join('company_integrations', 'companies.id', '=', 'company_integrations.company_id')
.select('companies.id as id', 'companies.uuid as uuid', 'company_integrations.method as method', 'company_integrations.configurations as configurations').limit(5).then(function(resp) {
logger.capture('info', resp)
})
我的查询输出
{
"level": "info",
"timestamps": "17:44:39",
"message": [
{
"id": 1475,
"uuid": "92db9710-5276-11e8-a91b-2f2aa8f44baa",
"method": "open-api",
"configurations": "{\"company_code\":\"034\",\"issue_point_rate\":\"10.00\",\"issue_fee_rate\":\"5.00\",\"redeem_fee_rate\":\"20.00\"}"
},
{
"id": 1086,
"uuid": "7cfcbd00-333e-11e8-8e97-ad56f124a756",
"method": "ponta",
"configurations": "{\"company_code\":\"034\",\"issue_point_rate\":\"10.00\",\"issue_fee_rate\":\"5.00\",\"redeem_fee_rate\":\"20.00\"}"
},
{
"id": 1565,
"uuid": "5795c950-5cff-11e8-b813-1782fbf3df1c",
"method": "ponta",
"configurations": "{\"company_code\":\"034\",\"issue_point_rate\":\"10.00\",\"issue_fee_rate\":\"5.00\",\"redeem_fee_rate\":\"20.00\",\"merchant_id\":\"1abc\",\"active\":0}"
},
{
"id": 1565,
"uuid": "5795c950-5cff-11e8-b813-1782fbf3df1c",
"method": "e-cash",
"configurations": "{\"active\":true}"
},
{
"id": 2015,
"uuid": "4b615d90-7dc3-11e8-8d59-012e7c4e4fb1",
"method": "yap!",
"configurations": "{\"company_code\":\"034\",\"issue_point_rate\":\"10.00\",\"issue_fee_rate\":\"5.00\",\"redeem_fee_rate\":\"20.00\"}"
}
]
}
我想使用whereRaw在条件类似时仅检查/过滤数据
configurations->active=true
或价值
configurations->company\u code=something
如何过滤内部JSON数据