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

fix: invalid key reference in retrieving form submissions #385

Merged
merged 2 commits into from
Sep 30, 2020

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Sep 29, 2020

Problem

searchSubmissionsForForm aggregate pipeline step was incorrectly matching against a key of key instead of the key parameter passed into the function:

let searchSubmissionsForForm = (key, formId) => [
  {
    $match: {
      // key "key" is matched instead of the key parameter.
      key: mongoose.Types.ObjectId(formId),
    },
  },
]

This PR fixes that by correctly using the given key parameter as a match key:

let searchSubmissionsForForm = (key, formId) => [
  {
    $match: {
      [key]: mongoose.Types.ObjectId(formId),
    },
  },
]

@karrui karrui requested a review from arshadali172 September 29, 2020 09:39
@karrui karrui merged commit 98d5345 into develop Sep 30, 2020
@karrui karrui deleted the fix/nullish-example-feedback-subs branch September 30, 2020 03:09
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.

2 participants