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

Feather-sequelize $or operator not working #299

Closed
Arc009 opened this issue May 8, 2019 · 1 comment
Closed

Feather-sequelize $or operator not working #299

Arc009 opened this issue May 8, 2019 · 1 comment

Comments

@Arc009
Copy link

Arc009 commented May 8, 2019

$or doesn't work in any syntax form. (f.i. https://stackoverflow.com/questions/20695062/sequelize-or-condition-object)

Snippet

const addAssociation = (context) => { const demos = context.app.services['demos'].Model; context.params.sequelize = { raw: false, where: { $or: [{ isVisible: true }, { isValid: true }] }, attributes: { as: 'demos', include: helperDemos } }; delete context.params.query.include; return Promise.resolve(context); };

------------------------------
Server response:
{
    "name": "GeneralError",
    "message": "Invalid value { isVisible: true }",
    "code": 500,
    "className": "general-error",
    "data": {},
    "errors": {}
}

### Expected behavior
The query should perform a simple 'or' operation.

### System configuration
  "@feathersjs/authentication": "^2.1.16",
    "@feathersjs/authentication-jwt": "^2.0.10",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/authentication-oauth2": "^1.3.1",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "compression": "^1.7.4",
    "cors": "^2.8.5",
    "feathers-authentication-hooks": "^0.3.1",
    "feathers-authentication-management": "^2.0.1",
    "feathers-hooks-common": "^4.20.7",
    "feathers-mailer": "^3.0.1",
    "feathers-sequelize": "^4.1.1",
    "helmet": "^3.18.0",
    "multer": "^1.4.1",
    "nodemailer-smtp-transport": "^2.7.4",
    "passport-google-oauth20": "^1.0.0",
    "pg": "^7.10.0",
    "sequelize": "^4.44.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.2.1"
**NodeJS version**:
^10
**Operating System**:
Mac
@daffl
Copy link
Member

daffl commented May 8, 2019

$or is only supported by the Feathers common query syntax passed via params.query. When using params.sequelize you need to use Sequelize operators ([Op.or]: [])

@daffl daffl closed this as completed May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants