sequelize-typescript querying if string contains word

六眼飞鱼酱① 提交于 2021-02-08 11:53:22

问题


I m using Nestjs + sequelize-typescript + postgresql. I would like to select rows in table that content contains specific word. this is my code :

async findUsers(searchedWord: string): Promise<users[]> {
		return await this.USER_REPOSITORY.findAll({
			attributes: [ 'id', 'name' ],
			where: {
				content: '%'+ searchedWord +'%'
			},
			order: [ [ 'id', 'ASC' ] ]
		});
	}
}

but this method didn't work ! Any suggestions ?

来源:https://stackoverflow.com/questions/59533244/sequelize-typescript-querying-if-string-contains-word

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!