如何使用 Sails.js v1 中的 .find() 方法进行不区分大小写的搜索

How to use the .find() method in Sails.js v1 to search case-insensitive

长话短说,find 方法搜索是区分大小写的,我希望它以不区分大小写的方式搜索。使包含修饰符不区分大小写 In Mongo.

return res.send(await Template.find({
  where: { 'title' : { startsWith : 'f' }
}));

就我而言,我是这样解决的:

ALTER TABLE 'some_table' convert TO CHARACTER SET utf8 COLLATE utf8_unicode_ci

Sails documentation 说 "In order to fix this you can set the tables in your MySQL database to a case sensitive collation such as utf8_bin." 我使用 "utf8_unicode_ci" 因为这是不区分大小写的排序规则。