Skip to content

Commit 45a4397

Browse files
committed
centralize mongo schema handling logic
1 parent 589ff21 commit 45a4397

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Adapters/Storage/Mongo/MongoSchemaCollection.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ function mongoSchemaFromFieldsAndClassNameAndCLP(fields, className, classLevelPe
126126
}
127127
}
128128

129-
// Legacy mongo adapter knows about the difference between password and _hashed_password.
130-
// Future database adapters will only know about _hashed_password.
131-
// Note: Parse Server will bring back password with injectDefaultSchema, so we don't need
132-
// to add it here.
133-
delete mongoObject._hashed_password;
134-
135129
return mongoObject;
136130
}
137131

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ const storageAdapterAllCollections = mongoAdapter => {
3737
const convertParseSchemaToMongoSchema = ({...schema}) => {
3838
delete schema.fields._rperm;
3939
delete schema.fields._wperm;
40+
41+
if (schema.className === '_User') {
42+
// Legacy mongo adapter knows about the difference between password and _hashed_password.
43+
// Future database adapters will only know about _hashed_password.
44+
// Note: Parse Server will bring back password with injectDefaultSchema, so we don't need
45+
// to add _hashed_password back ever.
46+
delete schema.fields._hashed_password;
47+
}
48+
4049
return schema;
4150
}
4251

0 commit comments

Comments
 (0)