Updating with two GeoPoints fails correctly. (#4162)

This commit is contained in:
Anthony Mosca
2017-09-19 20:42:40 +09:30
committed by Florent Vilmart
parent 406a21e967
commit cf630ba462
3 changed files with 29 additions and 6 deletions

View File

@@ -152,7 +152,11 @@ class MongoSchemaCollection {
addFieldIfNotExists(className: string, fieldName: string, type: string) {
return this._fetchOneSchemaFrom_SCHEMA(className)
.then(schema => {
// The schema exists. Check for existing GeoPoints.
// If a field with this name already exists, it will be handled elsewhere.
if (schema.fields[fieldName] != undefined) {
return;
}
// The schema exists. Check for existing GeoPoints.
if (type.type === 'GeoPoint') {
// Make sure there are not other geopoint fields
if (Object.keys(schema.fields).some(existingField => schema.fields[existingField].type === 'GeoPoint')) {