Skip to content
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

UID stored as integer instead of a string #738

Open
tomkersten opened this issue Jan 18, 2013 · 4 comments
Open

UID stored as integer instead of a string #738

tomkersten opened this issue Jan 18, 2013 · 4 comments

Comments

@tomkersten
Copy link

I noticed the UID from OAuth requests are being stored as an Integer (cast via #to_i). I am not familiar enough with mongo to know whether there is significant performance gain by using an Integer over a string. However, this forces providers to use integer IDs for users, which is unfortunate (eg: UIDs are not an option).

  1. Is there a reason this is stored as an Integer instead of a string (as the omniauth gem suggests)?
  2. Is changing this an option/realistic?
@steveklabnik
Copy link
Contributor

I don't remember why this decision was made.

Sure, it's realistic. It's a document store, there's no schema! Seems fine.

@wilkie
Copy link
Contributor

wilkie commented Jan 21, 2013

Twitter uses integer uids, so it doesn't really matter. The reason why you are supposed to use strings is that you get the data in json, and ( tilts head ) javascript doesn't have a defined integer type. But, since the string can be converted to an integer reliably in ruby, it's not a problem.

There is theoretically no significant difference in storing the integer or the string version.

@tomkersten
Copy link
Author

Right. I guess my question was brought up because I am interested in making it easy to integrate with other OAuth providers, and having this requirement requires all providers to use integers as their unique identifier for users. So, for example, a provider is not able to use UUIDs instead, because when it is cast via #to_i, it results in an ID of '0'...which is problematic.

@carols10cents
Copy link
Contributor

I don't see why not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants