Skip to content

Commit 397124a

Browse files
committed
Don't reject with object
1 parent 9d1906b commit 397124a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,12 @@ export class MongoStorageAdapter {
160160
}
161161

162162
// Remove all objects that match the given parse query. Parse Query should be in Parse Format.
163-
// If no objects match, reject with OBJECT_NOT_FOUND. If objects are found and deleted, resolve with nothing.
163+
// If no objects match, reject with OBJECT_NOT_FOUND. If objects are found and deleted, resolve with undefined.
164164
// If there is some other error, reject with INTERNAL_SERVER_ERROR.
165165

166166
// Currently accepts the acl, schemaController, validate
167167
// for lecacy reasons, Parse Server should later integrate acl into the query. Database adapters
168168
// shouldn't know about acl.
169-
170-
// Currently resolves with empty object because thats what HooksController expects, but that should change.
171169
deleteObjectsByQuery(className, query, acl, schemaController, validate) {
172170
return this.adaptiveCollection(className)
173171
.then(collection => {
@@ -186,7 +184,9 @@ export class MongoStorageAdapter {
186184
if (result.n === 0) {
187185
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.');
188186
}
189-
return Promise.resolve({});
187+
return Promise.resolve();
188+
}, error => {
189+
throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, 'Database adapter error');
190190
});
191191
}
192192

0 commit comments

Comments
 (0)