Remove .rawCollection method from DatabaseController.

This commit is contained in:
Nikita Lutsenko
2016-03-07 14:16:26 -08:00
parent 7909f0efe0
commit f2ead46580
3 changed files with 11 additions and 15 deletions

View File

@@ -35,7 +35,7 @@ DatabaseController.prototype.collection = function(className) {
throw new Parse.Error(Parse.Error.INVALID_CLASS_NAME,
'invalid className: ' + className);
}
return this.rawCollection(className);
return this.adapter.collection(this.collectionPrefix + className);
};
DatabaseController.prototype.adaptiveCollection = function(className) {
@@ -46,10 +46,6 @@ DatabaseController.prototype.collectionExists = function(className) {
return this.adapter.collectionExists(this.collectionPrefix + className);
};
DatabaseController.prototype.rawCollection = function(className) {
return this.adapter.collection(this.collectionPrefix + className);
};
DatabaseController.prototype.dropCollection = function(className) {
return this.adapter.dropCollection(this.collectionPrefix + className);
};

View File

@@ -63,23 +63,19 @@ export class PushController extends AdaptableController {
let badgeUpdate = Promise.resolve();
if (body.badge) {
var op = {};
let op = {};
if (body.badge == "Increment") {
op = {'$inc': {'badge': 1}}
op = { $inc: { badge: 1 } }
} else if (Number(body.badge)) {
op = {'$set': {'badge': body.badge } }
op = { $set: { badge: body.badge } }
} else {
throw "Invalid value for badge, expected number or 'Increment'";
}
let updateWhere = deepcopy(where);
updateWhere.deviceType = 'ios'; // Only on iOS!
// Only on iOS!
updateWhere.deviceType = 'ios';
// TODO: @nlutsenko replace with better thing
badgeUpdate = config.database.rawCollection("_Installation").then((coll) => {
return coll.update(updateWhere, op, { multi: true });
});
badgeUpdate = config.database.adaptiveCollection("_Installation")
.then(coll => coll.updateMany(updateWhere, op));
}
return badgeUpdate.then(() => {