Open dtoubelis opened 8 years ago
You can call toString
on a query, as for save
, you can't easily print things at the moment.
I do this in my development environment:
var Thinky = require("thinky");
var thinky = Thinky({
host: Config.rethink.host,
port: Config.rethink.port,
db: Config.rethink.db
});
if (Config.env === "dev") {
// intercept and output reql in dev environment
thinky.r._Term.prototype.run = _.wrap(thinky.r._Term.prototype.run, function (func) {
console.error(this.toString());
var trailingArguments = [].slice.call(arguments, 1);
return func.apply(this, trailingArguments);
});
}
@brandon-beacher That is clever :-) Thanks.
Is there any parameter I can pass when instantiating thinky that would cause it to print reql statements that are sent to the server? That would be very helpful debugging tool.