Skip to content

Fix MongoDB error Unknown modifier: $pushAll#7

Open
scaccoman wants to merge 1 commit into
StephenGrider:masterfrom
scaccoman:patch-1
Open

Fix MongoDB error Unknown modifier: $pushAll#7
scaccoman wants to merge 1 commit into
StephenGrider:masterfrom
scaccoman:patch-1

Conversation

@scaccoman
Copy link
Copy Markdown

When running the following GraphQL query:

mutation {
  addLyricToSong(songId: "5af29df7c084014b34d2bb8a", content: "Oh my oh my its a cold night"){
    id
  }
}

This error is returned from my locally hosted MongoDB:

{
  "data": {
    "addLyricToSong": null
  },
  "errors": [
    {
      "message": "Unknown modifier: $pushAll",
      "locations": [
        {
          "line": 9,
          "column": 3
        }
      ],
      "path": [
        "addLyricToSong"
      ]
    }
  ]
}

Adding {usePushEach: true} solves the problem. Ref: https://medium.com/@stefanledin/how-to-solve-the-unknown-modifier-pushall-error-in-mongoose-d631489f85c0

When running the following GraphQL query:
mutation {
  addLyricToSong(songId: "5af29df7c084014b34d2bb8a", content: "Oh my oh my its a cold night"){
    id
  }
}
This error is returned from my locally hosted MongoDB:
{
  "data": {
    "addLyricToSong": null
  },
  "errors": [
    {
      "message": "Unknown modifier: $pushAll",
      "locations": [
        {
          "line": 9,
          "column": 3
        }
      ],
      "path": [
        "addLyricToSong"
      ]
    }
  ]
}

Adding {usePushEach: true} solves the problem. Ref: https://medium.com/@stefanledin/how-to-solve-the-unknown-modifier-pushall-error-in-mongoose-d631489f85c0
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

Successfully merging this pull request may close these issues.

1 participant