东方查询生成器类似子句



我正在尝试使用东方数据库界面获取自动完成工作。

Web服务器是带有快速框架的nodeJS,服务器代码如下:

express.get("/piatti", function(req, res) {
    var tipo = req.query.tipo;
    var nome = req.query.nome;
    var filtriRicerca = {};
    var tabella = modules.database.db.select().from('PIATTI');
    if(tipo) {
        filtriRicerca.tipo = tipo;
    }
    if(nome) {
        filtriRicerca.nome = nome;
    }
    console.log(JSON.stringify(filtriRicerca));
    if(Object.keys(filtriRicerca).length) {
        console.log("Aggiunto il filtro");
        tabella = tabella.where(filtriRicerca);
    }
    tabella.all().then(function (piatti) {
        res.json(piatti);
    });
});

我不知道如何让 where 子句工作为"像 filtriRicerca.nome%"。

提前感谢,马蒂亚

Mattia,一个可能的替代解决方案是将 Waterline ORM 与 sails-orientdb 适配器一起使用。 sails-orientdb 使用 Oriento,因此您可以随时访问 Oriento 的方法,并且可以执行如下like查询:

Model.find({ food: { 'like': '%beans' }})

有关吃水线文档的更多示例。

最新更新