-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding unique emails #3
Comments
That will work assuming the index is there, but should probably be combined with something that checks if the query contains {index: ...} and if so making sure the index exists with something like this before attempting to use the index: r.db('somedb').table('users').indexList().contains('email')
.do(function (indexExists) {
return r.branch(indexExists, { created: 0 }, r.db('somedb').table('users').indexCreate('email'))
}) That of course has to be abstracted the way db and table are now in feathers-rethink to automate it. |
Should I make this its own service or use hooks? |
I guess that depends on if you want it always, or sometimes. If always make it a hook that always runs. If sometimes, either it's own service that you can call it independently when needed, or a hook with an option to specify whether or not to run it for any given call. The real question is whether or not there would ever be any scenario where you might want to allow duplicates for any reason - even temporarily like maybe for a data merge or something. |
ATM, there is nothing to ensure that emails are unique
Suggested code:
The text was updated successfully, but these errors were encountered: