RethinkDB 单个请求中的多个查询 [英] RethinkDB multiple queries in a single request

查看:53
本文介绍了RethinkDB 单个请求中的多个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在对服务器的单个请求中执行多个 RQL 命令,但我可能添加的成功不多.我试过 r.union,但它只适用于序列.我真正想要的:

I'm trying to execute several RQL commands in a single request to server, without much success I may add. I have tried r.union, but it only works with sequences. What I really want:

[r.db(..).table(..).get(id1).delete(),
 r.db(..).table(..).get(id2).delete(),
 r.db(..).table(..).insert(...)].run_all_at_once

有没有办法做到这一点?

Is there any way to do this?

谢谢!

推荐答案

你可以做

r.expr( [r.db(...).table(...).get(id1).delete(), 
r.db(...).table(...).get(id1).delete(), 
r.db(...).table(...).insert(...) ] ).run(conn)

请注意,delete 方法没有参数.

Note that the method delete doesn't get an argument.

这篇关于RethinkDB 单个请求中的多个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆