Skip to content

notEqualTo does not accumulate when used multiple times #7459

@sadortun

Description

@sadortun

New Issue Checklist

Issue Description

Hi !

Lets say you want to get all documents where the name is not bob or john. The simplest way you can do this is something like this :

Steps to reproduce

const q = new Parse.Query(User)

q.notEqualTo('name', 'bob')
q.notEqualTo('name', 'john')

await q.find()

Unfortunatly, this query will be executed as

{
  where: {
    "name": {
      "$ne": "john"
      }
   }
}

Actual Outcome

The results will contains users with name=bob.

Expected Outcome

The objects should not include any 'bob' or 'john'

Alternatively, if multiple notEqualTo is not accepted on the same key, an exception should be thrown on later calls to advise everyone to use notContainedIn or another more appropriate function.

Also, the docs do not reflect this limitation.

Failing Test Case / Pull Request

Environment

Server

  • Parse Server version: master / 129f7bfa9b7a3252b2d75524f441e81b7c37231c
  • Operating system: FILL_THIS_OUT
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): FILL_THIS_OUT

Database

  • System (MongoDB or Postgres): mongo
  • Database version: ``
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): js
  • SDK version: FILL_THIS_OUT

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions