[英]Oriento query builder like clause
I'm trying to get an autocomplete work with a oriento db interface. 我正在尝试使用oriento db接口进行自动完成工作。
The webserver is nodeJS with express framework and the server code is this: 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);
});
});
I cant figure out how to to get the where clause work as 'like filtriRicerca.nome%'. 我无法弄清楚如何使where子句像filtriRicerca.nome%一样工作。
Thanks in advance, Mattia 在此先感谢,Mattia
Mattia, a possible alternative solution to your problem is to use the Waterline ORM with the sails-orientdb adapter. Mattia,针对您的问题的可能替代解决方案是将Waterline ORM与sails-orientdb适配器一起使用。 sails-orientdb uses Oriento so you can access Oriento's methods anytime and you can do like
queries like this: sails-orientdb使用Oriento,因此您可以随时访问Oriento的方法,并且可以like
查询:
Model.find({ food: { 'like': '%beans' }})
More examples on the waterline docs . 有关水线文档的更多示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.