我的问题是:
- 如何进行从服务器到数据库的查询?
我一直在阅读一些文章并从 Udemy 看到一些关于 OrientDB 的教程,我发现什么是查询语言,比如 SQL,但我找不到如何将查询从服务器发送到数据库 OrientDB 。我在 Node.js 中制作服务器。
我找到了如何启动和关闭连接:
var OrientDB = require('orientjs');
var server = OrientDB({
host: 'localhost',
port: 8082, //I am using the port 8081 for Binary and 8082 for Http
username: 'root',
password: 'rootPassword'
});
server.close();
我一直在阅读 OrientDB 文档,但找不到它。 http://orientdb.com/docs/last/index.html
最佳答案
只需要在官方文档中搜索即可
http://orientdb.com/docs/last/OrientJS.html
http://orientdb.com/docs/last/OrientJS-Database.html
var targetAvg = 0.3;
var targetTeam = 'Red Sox';
var hitters = db.query(
'SELECT name, battavg FROM Player WHERE battavg >= :ba AND team = :team',
{params: {
ba: targetAvg,
team: targetTeam
},limit: 20 }
).then(
function(players){
console.log(players);
}
);
关于mysql - 如何从 Node.js 中的服务器向数据库 OrientDB 进行查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39967922/