-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add config for objectId size #3950
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
Add config for objectId size #3950
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3950 +/- ##
==========================================
- Coverage 90.59% 90.58% -0.02%
==========================================
Files 115 115
Lines 7784 7786 +2
==========================================
+ Hits 7052 7053 +1
- Misses 732 733 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
We might want to add a test to ensure that even when increasing/decreasing the size of an objectId values that are shorter/longer than the current setting still are able to be read and processed without any errors. |
Let’s make it for 2.6.0, i’d Like to release 2.5.0 ASAP :) |
Added a test that creates an object with a short objectId then increases the objectId size setting to perform a find, then an update. The second part of the test creates an object with a long objectId and decreases the objectId size setting to perform a find only. Let me know if you don't think this is sufficient, or overkill as not sure part two is required - increasing the setting should be no different to decreasing, as long as there is no code that checks inequalities. I don't think we actually check anything with the objectId length but could be wrong. |
@@ -35,9 +35,8 @@ export function randomString(size: number): string { | |||
} | |||
|
|||
// Returns a new random alphanumeric string suitable for object ID. | |||
export function newObjectId(): string { | |||
//TODO: increase length to better protect against collisions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally someone took care of this //TODO
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's funny, I must have seen that comment over a year ago and it never registered that there might be a problem :)
Waiting release of 2.5.0 to merge this |
Hi @steven-supersolid , Thanks for this add :) |
Using the environment variable should work if you launch from the CLI but won't work when mounted as express middleware. In that case use the constructor parameter The setting will also not affect any old id's and I'm unsure how the id's will display in the dashboard, so recommend checking your database entries too. |
@steven-supersolid Ok, my Parse server is mounted with express, I will pass the objectIdSize parameter in the constructor, thanks for the quick response! It Works ! |
The current objectId length of 10 mixed case alphanumeric characters is only really suitable for classes that contain up to 1 million objects.
This review adds a new constructor option objectIdSize which defaults to the current value of 10, can also be set via the environment variable PARSE_OBJECT_ID_SIZE.