You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the metadata field does not exist in collection application - then create the field metadata.type=application.type
Current Behavior
Upgrade script fails with
TypeError: application.metadata is undefined
Possible Solution
The expression in the if statement
if (application.type && !application.metadata && !application.metadata.type)
might be rewritten to
if (application.type && !("metadata" in application))
Steps to Reproduce (for bugs)
install version 1.24 using mongodb db store
upgrade software to version 1.25
run mongodb upgrade scripts
Context
Failing to run mongodb upgrade scripts results in http-400 on a HTTP PUT /management/apis/ and visual error 'must not be null' in ui when modifying policies
Your Environment
Version used: 1.25 & 1.26
The text was updated successfully, but these errors were encountered:
Do you think you can provide a PR to fix the script ?
Thanks.
brasseld
changed the title
Mongodb upgrade script 1.25 fails when application.metadata field does not exist
[repository] [mongodb] Upgrade script 1.25 fails when application.metadata field does not exist
Jun 4, 2019
When upgrade to version 1.25 (or through 1.25 to 1.26), one needs to run mongodb upgrade
scripts as explained by https://github.com/gravitee-io/release/tree/master/upgrades/1.25.0
However, the first script fails if the collection application does not have the metadata field
https://raw.githubusercontent.com/gravitee-io/release/master/upgrades/1.25.0/mongodb/1-applications-migration.js
Expected Behavior
If the metadata field does not exist in collection application - then create the field metadata.type=application.type
Current Behavior
Upgrade script fails with
TypeError: application.metadata is undefined
Possible Solution
The expression in the if statement
if (application.type && !application.metadata && !application.metadata.type)
might be rewritten to
if (application.type && !("metadata" in application))
Steps to Reproduce (for bugs)
Context
Failing to run mongodb upgrade scripts results in http-400 on a HTTP PUT /management/apis/ and visual error 'must not be null' in ui when modifying policies
Your Environment
The text was updated successfully, but these errors were encountered: