【发布时间】:2020-01-14 01:00:37
【问题描述】:
我正在使用带有 postgresql 数据库的书架
Information 是 json 类型的列。
我想检索所有类似于 '%pattern%' 的列 我使用 sql 查询
select * from table where information::text like '%pattern%';
我想用书架查询生成器来做到这一点
model.query(function(qb) {
qb.where('information', 'LIKE', '%pattern%')
}).fetch()
但它不起作用,我在bookshelf docs中找不到如何做
有什么想法吗?
【问题讨论】:
-
为什么要以 JSON 等结构化数据格式进行文本搜索?
标签: json postgresql knex.js bookshelf.js