RethinkDB: Ends With Example

RethinkDB filters work on regular expressions, so you can simply match on the end of the line to filter a result:

r.db('test')
 .table('users')
  .filter( (doc) => doc('user_name').match("ieling$") )

If you want this to be case-insensitive, do the following:

r.db('test')
 .table('users')
  .filter( (doc) => doc('user_name').downcase().match("ieling$") )

Leave a Reply

Your email address will not be published. Required fields are marked *