You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ReQL doesn't have an undefined datatype. What would be convenient for the users is to implicitly treat undefined as NULL and pass NULL to rethinkdb. This conversion should be handled at thinky layer.
I have below code that fails when either username or email is undefined.
Logically since I have a users table where email or username cannot be null/undefined I would expect this query to return 0 results. This is what mongo returns since many of the developers actively work on mongo we would expect this to work the same way.
What I would like is for this query to not throw error and return 0 results.
I have been reading the docs and is not able to find the solution. How to get this done in rethink world.
This will return all the users and completely ignore undefined value for username. This is logically not correct since ideally this should not return any results because there are no records where username is undefined.
Additional Info
User is a thinky model
const User = thinky.createModel('users', {
id: type.string().uuid(4),
fullName: type.string().required(),
username: type.string().required(),
email: type.string().email().required(),
password: type.string().required(),
firstName: type.string().alphanum().allowNull(true),
lastName: type.string().alphanum().allowNull(true),
bio: type.string().allowNull(true),
// the timestamp this resource is created
createdAt: type.number().integer().required(),
// the timestamp this resource was last updated
updatedAt: type.number().integer().required(),
}, {
enforce_extra: 'remove',
enforce_type: 'strict',
});
The text was updated successfully, but these errors were encountered:
Continuing from here
ReQL doesn't have an undefined datatype. What would be convenient for the users is to implicitly treat undefined as NULL and pass NULL to rethinkdb. This conversion should be handled at thinky layer.
username
oremail
isundefined
.This will throw error
As a workaround below code works
Logically since I have a users table where
email
orusername
cannot benull/undefined
I would expect this query to return0
results. This is what mongo returns since many of the developers actively work on mongo we would expect this to work the same way.What I would like is for this query to not throw error and return 0 results.
I have been reading the docs and is not able to find the solution. How to get this done in rethink world.
This will return all the users and completely ignore
undefined
value for username. This is logically not correct since ideally this should not return any results because there are no records whereusername
is undefined.Additional Info
User
is athinky
modelThe text was updated successfully, but these errors were encountered: