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

MongoIds pass integer validation whether you are using mongo or not #4659

Closed
kevinburkeshyp opened this issue Dec 12, 2015 · 5 comments
Closed

MongoIds pass integer validation whether you are using mongo or not #4659

kevinburkeshyp opened this issue Dec 12, 2015 · 5 comments
Labels

Comments

@kevinburkeshyp
Copy link

@kevinburkeshyp kevinburkeshyp commented Dec 12, 2015

Relevant code in core/validations.js

    // If type is integer and the value matches a mongoID let it validate
    if(hasOwnProperty(self.validations[validation], 'type') && self.validations[validation].type === 'integer') {
      if(utils.matchMongoId(value)) return cb();
    }

So it seems like if I am using Postgres but I pass something like "4cdfb11e1f3c000000007822" as an integer value, Waterline will pass it to the database without applying the normal validation.

@devinivy
Copy link

@devinivy devinivy commented Dec 14, 2015

I agree that this is smelly. We need to rip out some mongo-specific references within waterline, including this. Adapters currently do have the ability to set their own primary key type.

@johnabrams7 johnabrams7 transferred this issue from balderdashy/waterline Mar 6, 2019
@johnabrams7
Copy link
Contributor

@johnabrams7 johnabrams7 commented Mar 6, 2019

@kevinburke @devinivy Hey, we moved this Mongolds issue to our main Sails hub with the label "orm." It appears to have been patched in a newer version of Waterline. Thanks for sharing this info and hope it's working for everyone now.

@kevinburke
Copy link
Contributor

@kevinburke kevinburke commented Mar 6, 2019

Great! Thanks!

@raqem
Copy link
Contributor

@raqem raqem commented Apr 10, 2019

Hi @kevinburke @devinivy we are further cleaning up the Sails issues by closing old ones and issues that have been patched with newer versions.

@raqem raqem closed this Apr 10, 2019
@johnabrams7
Copy link
Contributor

@johnabrams7 johnabrams7 commented Apr 10, 2019

This has been published.

@balderdashy balderdashy locked as resolved and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.