如何从 Node.js 中的服务器对数据库 OrientDB 进行查询

How to make a Queries from the server in Node.js to the database OrientDB

我的问题是:

我一直在阅读一些文章并从 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);
   }
);