Check expected type is array from Parse Format Schema
This commit is contained in:
@@ -195,7 +195,10 @@ function transformQueryKeyValue(schema, className, key, value, { validate } = {}
|
|||||||
(!expected && value && value.__type == 'Pointer')) {
|
(!expected && value && value.__type == 'Pointer')) {
|
||||||
key = '_p_' + key;
|
key = '_p_' + key;
|
||||||
}
|
}
|
||||||
const expectedTypeIsArray = (expected && expected.type === 'Array');
|
const expectedTypeIsArray =
|
||||||
|
parseFormatSchema &&
|
||||||
|
parseFormatSchema.fields[key] &&
|
||||||
|
parseFormatSchema.fields[key].type === 'Array'
|
||||||
|
|
||||||
// Handle query constraints
|
// Handle query constraints
|
||||||
if (transformConstraint(value, expectedTypeIsArray) !== CannotTransform) {
|
if (transformConstraint(value, expectedTypeIsArray) !== CannotTransform) {
|
||||||
|
|||||||
@@ -654,7 +654,8 @@ DatabaseController.prototype.find = function(className, query, {
|
|||||||
if (!isMaster) {
|
if (!isMaster) {
|
||||||
query = addReadACL(query, aclGroup);
|
query = addReadACL(query, aclGroup);
|
||||||
}
|
}
|
||||||
return schemaController.getOneSchema(className)
|
return schemaController.reloadData()
|
||||||
|
.then(() => schemaController.getOneSchema(className))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
// If the schema doesn't exist, pretend it exists with no fields. This behaviour
|
// If the schema doesn't exist, pretend it exists with no fields. This behaviour
|
||||||
// will likely need revisiting.
|
// will likely need revisiting.
|
||||||
@@ -664,7 +665,7 @@ DatabaseController.prototype.find = function(className, query, {
|
|||||||
throw error;
|
throw error;
|
||||||
})
|
})
|
||||||
.then(parseFormatSchema => {
|
.then(parseFormatSchema => {
|
||||||
let mongoWhere = this.transform.transformWhere(schemaController, className, query, parseFormatSchema);
|
let mongoWhere = this.transform.transformWhere(schemaController, className, query, {}, parseFormatSchema);
|
||||||
if (count) {
|
if (count) {
|
||||||
delete mongoOptions.limit;
|
delete mongoOptions.limit;
|
||||||
return collection.count(mongoWhere, mongoOptions);
|
return collection.count(mongoWhere, mongoOptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user