0
我试图对同一端点内的2个不同的表进行2次查询。我可以为简单的查询做到这一点,但不能用于更复杂的更新/替换查询。此外,我不知道如何正确处理这种情况下的错误。多个查询相同的路由端点在节点快递
下面是我的尝试:
function upvotePost(req,res,next){
/*query 1*/
r.table('posts').filter(function(post){
return post('id').eq(someId);
}).update(
{"upvotes": r.row("upvotes").add(1)}).run(req._rdbConn)
/*query 2*/
.then(function(){
r.table('users').filter(r.row('login').eq(someUser))
.update({upvotelist: r.row('upvotelist').changeAt(someId,1)})
.run(req._rdbConn).then(function(result){
res.send(JSON.stringify(result));
})
}).error(handleError(res))
.finally(next);
}
眼下这将返回一个连接关闭错误。
你能发布的代码示例? – nha