0

I want to retrieve all User or get all User with Name variable. I'm using Rethinkdb and I want to convert SQL Server to Rethinkdb with my query

SQL Server:

SELECT * FROM User
WHERE Name = '' OR Name = @ Name

This 's my Rethinkdb query, but It not working right

rethink.table('User')
.filter(
rethink.row('Name').eq(Name).or(rethink.row('Name'))
)
.run(conn, callback)
Truc
  • 386
  • 4
  • 12
  • Can you try modifying your filter to: rethink.row('Name').eq(Name).or(rethink.row('Name').eq('')) –  Apr 07 '16 at 18:25

1 Answers1

0

You could do:

r.table('User').filter(function(d){
    return r.expr([Name, ""]).contains(d('Name'))
})
DevLounge
  • 8,313
  • 3
  • 31
  • 44