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

don't throw error when comparing options with/without collation #9224

Merged
merged 1 commit into from
Jul 10, 2020

Conversation

clhuang
Copy link
Contributor

@clhuang clhuang commented Jul 9, 2020

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory.

If you're making a change to documentation, do not modify a .html file directly. Instead find the corresponding .pug file or test case in the test/docs directory.

Summary
On a collection, and in the schema, have an index with and without a collation. Run syncIndexes(), it fails at line 21 with TypeError: Cannot convert undefined or null to object when key is "collation" but options.collation is undefined.

Examples
Example arguments to isIndexesEqual that throw an error:

key = { name: 1 };
options = { unique: true, background: true };
dbIndex = {
  v: 2,
  unique: true,
  key: { name: 1 },
  name: 'name_case_insensitive',
  ns: 'main.tags',
  background: true,
  collation: {
    locale: 'en',
    caseLevel: false,
    caseFirst: 'off',
    strength: 2,
    numericOrdering: false,
    alternate: 'non-ignorable',
    maxVariable: 'punct',
    normalization: false,
    backwards: false,
    version: '57.1'
  }
};

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this 👍

@vkarpov15 vkarpov15 added this to the 5.9.23 milestone Jul 10, 2020
@vkarpov15 vkarpov15 merged commit f71eaff into Automattic:master Jul 10, 2020
vkarpov15 added a commit that referenced this pull request Jul 10, 2020
vkarpov15 added a commit that referenced this pull request Jul 10, 2020
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