Gary Sieling

RethinkDB: Starts with example

RethinkDB filters work on regular expressions. To do starts with queries, you can match the regular expression on the start of the data:

r.db('test')
 .table('users')
  .filter( (doc) => doc('user_name').match("^.*ielin") )

Note that the end isn’t matched, so it will include results with various ends.

first_name
id
last_name
user_name
1
gary
72b719a2-0a96-4b54-aaba-63b76e5c3c75
sieling
gsieling
Exit mobile version