Fix some stuff

This commit is contained in:
Drew Gross
2016-06-13 12:57:20 -07:00
parent f796d69d19
commit a69a88f3a4
9 changed files with 86 additions and 62 deletions

View File

@@ -67,8 +67,8 @@ const validateQuery = query => {
}
Object.keys(query).forEach(key => {
if (query[key].$regex) {
if (typeof query[key].$options === 'string') {g
if (query && query[key] && query[key].$regex) {
if (typeof query[key].$options === 'string') {
if (!query[key].$options.match(/^[imxs]+$/)) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, `Bad $options value for query: ${query[key].$options}`);
}
@@ -764,7 +764,7 @@ DatabaseController.prototype.deleteSchema = function(className) {
})
.then(schema => {
return this.collectionExists(className)
.then(exist => this.adapter.count(className))
.then(exist => this.adapter.count(className, { fields: {} }))
.then(count => {
if (count > 0) {
throw new Parse.Error(255, `Class ${className} is not empty, contains ${count} objects, cannot drop schema.`);