- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用Orientjs从nodejs脚本访问Orientdb数据库,但服务器端功能不会影响数据库。
服务器端脚本:此 Javascript 函数 addTxt()
采用参数 author
和 text
var db = orient.getGraph();
db.command('sql','insert into Message (author, text) VALUES ("'+author+'", "'+text+'")');
return "1";
查询:此函数已在 Orient Studio 中测试,以下查询有效:
SELECT addTxt("Testuser","foo")
Nodejs/Orientjs:当使用Orientjs从nodejs脚本调用此函数时,它仅返回
[ { '@type': 'd', addTxt: '1', '@rid': { cluster: -2, position: 1 } } ]
并且数据库保持不变。
我已经尝试过:
//some code
var OrientDB = require('orientjs');
var server = OrientDB({
host: 'localhost',
port: 2424,
});
var db = server.use({
name: 'database',
username: 'admin',
password: 'pass'
db.query('SELECT addTxt(:arg1, :arg2)', {
params: {arg1:"Testuser",arg2:"foo"}
}).then(function (response){
console.log(response);
});
来自 Orientjs 的其他查询有效。
我做错了什么?还有其他方法来调用服务器端函数吗?
最佳答案
您明确返回“1”
返回是对的
[ { '@type': 'd', addTxt: '1', '@rid': { cluster: -2, position: 1 } } ]
尝试在函数中直接显式提交
db.commit()
关于javascript - 如何从Orientjs执行Orientdb服务器端函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31093147/
orientdb.insert() .into('User') .set({name: 'John', surname: 'Smith'}) .all(
如何使用 orientjs 在事务中更新插入边?我当前的实现更新插入两个顶点并总是创建一条新边: function add(db, from, edge, to, cb) { cb = cb ||
我想将 OrientJS 与 Express.js 一起使用。如何在发出任何 http 请求之前配置连接池,在请求/响应周期中从池中获取和释放连接,以及在关闭应用时完成连接池? 最佳答案 我查看了 O
我正在尝试使用 NodeJS 服务器上的 OrientJS 框架将对象保存到数据库中。该对象包含一些 native 参数以及应指向另一个类的记录的 RID 数组。看这个: var myObj = {
我正在尝试在 NodeJS(v0.12.2) 上使用 Orientjs(v2.0.0) 连接到 OriendDB(v2.0.13),如下所示: var OrientDB = require('orie
我不明白如何从 orientjs 查询中获取标准 JSON。我看到人们在谈论“序列化”结果,但我不明白为什么或如何做到这一点。有一个 toJSON() 方法,但我只看到它与 fetchplans 等一
如何在 oriento 中选择或更新多条记录?就像在吃水线上一样,我们可以 offersModel.update({id:items_ids,status:INACTIVE},{status:ACTI
我正在尝试做 orientjs 并表达 4 集成。 我对如何创建到 index.js 的路由感到困惑。 由于orientjs刚刚发布,我仍然找不到任何教程。 现在我只想从 orientdb 中做一个简
我想使用 OrientDB 作为 .csv 文件的数据库,并使用 OrientJS 将这些文件以原始形式存储在记录的二进制字段中。此外,我想将名称和描述存储为字符串。我浏览了文档并能够通过存储原始二进
我正在尝试使用 2.2 GA 版本的 OrientDB 测试最新版本的 orientjs。使用下面非常简单的代码,我没有得到任何错误或异常,也没有来自回调函数的输出。我也没有在 OrientDB 服务
在 Node 中,正确的执行方式是什么 Gremlin针对数据库的查询? 我当前尝试使用 Official Node OrientDB Driver : const { ODatabase } = r
我正在使用 Orientjs 创建一个具有一些属性的顶点以及一个链接属性“Relation”和一个序列属性“PersonID”。虽然我不知道如何实现以下目标:- var trx = this.db.l
我想在下面的环境中使用orientjs。 Windows 10 专业版 64 位 Node v6.9.2 node-gyp v3.4.0 orientjs 2.2.4 1) 安装“windows-bu
我正在使用 OrientJS (v2.2.10) 在 NodeJS (v8.11.3) 中开发一个应用程序,它将连接到本地托管的 OrientDB (v3.0.6) 数据库并进行查询。但是,当我尝试运
我是一名优秀的程序员,十分优秀!