kaicurry
kaicurry

Reputation: 199

Is it possible to print the created query, like shows up in error messages?

I really like how the error messages include a text string representing what the ReQL code looks like. Is it possible to get at this without forcing an error?

Example Error message:

RqlRuntimeError: No attribute `colors` in object:
{...}
in:
r.db("r_g").table("items").group("collection").ungroup().map(function(var_0) { return var_0("group").object(var_0("reduction")); }).concatMap(function(var_1) { return var_1("colors"); })

I'm wanting to get at the value after "in:" shown before I run() the query.

Upvotes: 2

Views: 191

Answers (1)

neumino
neumino

Reputation: 4353

You can use .toString() like query.toString() (without .run(...))

It should use the same code as the one used to generate backtraces.

I opened an issue this morning to add it in the docs, it is somehow missing -- https://github.com/rethinkdb/docs/issues/354

Upvotes: 4

Related Questions