I'm testing out some queries in the Data Explorer window. I'm trying to construct some basic queries using lambdas, but these queries fail.
For example, this query works:
r.db('libstats').table('flowcells').filter(
{barcode: 'H3YTYCCXX'}
)
But the same query reformatted as a lambda does not:
r.db('libstats').table('flowcells').filter(lambda fc: fc['barcode'] == "H3YTYCCXX" )
RethinkDB consistently reports the following error:
SyntaxError: missing ) after argument list
I'm using RethinkDB v2.0.3 What am I doing incorrectly?
As mentioned here:
The Data Explorer only supports JavaScript syntax, so just use a function (e.g. look at docs for
filter
: http://rethinkdb.com/api/javascript/filter/ …).
or here:
This post covers all aspects of lambda functions in ReQL from concept to implementation and is meant for third party driver developers and those interested in functional programming and programming language design.
in Data Explorer you can use Java Script function in filter.
In your case something like this:
r.db('libstats').table('flowcells').filter(function (fc) {
return fc('barcode').eq("H3YTYCCXX");
})