null check to oldField search #33
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Targeted to Fix the following Issue:
When search index is added to an old field in the schema.
Old Schema:
module.exports = {
type: 'timestamp',
}
New Schema:
module.exports = {
type: 'timestamp',
search: { type: ['NUMERIC', 'SORTABLE'] }
}
UpdateSchema command throws following error:
12|db | 2021-02-23T13:06:15: ReplyError: ERR Error running script (call to f_c545816098685cc5496530e85c8ac77be99fa5a2): @user_script:1089: user_script:1089: attempt to index field 'search' (a nil value)
12|db | 2021-02-23T13:06:15: at parseError (/home/vikas/repos/v2/node_modules/redis-parser/lib/parser.js:193:12)
12|db | 2021-02-23T13:06:15: at parseType (/home/vikas/repos/v2/node_modules/redis-parser/lib/parser.js:303:14) {
12|db | 2021-02-23T13:06:15: command: 'EVALSHA',
12|db | 2021-02-23T13:06:15: args: [
12|db | 2021-02-23T13:06:15: 'c545816098685cc5496530e85c8ac77be99fa5a2',
12|db | 2021-02-23T13:06:15: 0,
12|db | 2021-02-23T13:06:15: 'undefined:cb63e8d1-504c-4aac-a38c-ee40e7cea971',
As a fix added the null check.