Enable deleting pointer fields, fix tests

This commit is contained in:
Drew Gross
2016-02-10 16:25:28 -08:00
parent 0a0d4f65ef
commit 747f278f2a
2 changed files with 16 additions and 9 deletions

View File

@@ -471,8 +471,11 @@ Schema.prototype.deleteField = function(fieldName, className, database, prefix)
if (err) {
reject(err);
} else {
var mongoFieldName = schema.data[className][fieldName].startsWith('*') ?
'_p_' + fieldName :
fieldName;
return coll.update({}, {
"$unset": { [fieldName] : null },
"$unset": { [mongoFieldName] : null },
}, {
multi: true,
})