You can do the equivalent of “SELECT *” in RethinkDB by just selecting the table:
db.table('users')
Which returns the data:
first_name
|
id
|
last_name
|
user_name
|
|
1
|
gary
|
903e0943-8ffe-41ca-a22f-7b1a964b399d
|
sieling
|
gsieling
|
2
|
gary
|
479e9ce1-e0bb-46b3-a65f-554ac237460a
|
sieling
|
gsieling
|
3
|
test
|
1b223750-799d-402a-b378-74c993a9c10c
|
test
|
test
|
4
|
gary
|
947a3ce6-d419-4d31-bd1e-874c721a9e6c
|
sieling
|
gsieling
|
If you want to use a WHERE clause, you can provide a JSON payload that matches what you want, or use Javascript.
The nice thing about this is you can ES6 arrow functions, so the code is fairly concise, for Javascript:
r.db('test')
.table('users')
.filter(
(doc) => doc('last_name').eq('sieling')
);
r.db('test')
.table('users')
.filter({'last_name': 'sieling'})
The most difficult thing to get used to is that you can’t use “===”, “>=”, etc in your Javascript, since everything is functions.
first_name
|
id
|
last_name
|
user_name
|
|
1
|
gary
|
903e0943-8ffe-41ca-a22f-7b1a964b399d
|
sieling
|
gsieling
|
2
|
gary
|
479e9ce1-e0bb-46b3-a65f-554ac237460a
|
sieling
|
gsieling
|
4
|
gary
|
947a3ce6-d419-4d31-bd1e-874c721a9e6c
|
sieling
|
gsieling
|