@@ -316,7 +316,7 @@ function transformQueryKeyValue(className, key, value, schema, count = false) {
316
316
}
317
317
318
318
// Handle query constraints
319
- const transformedConstraint = transformConstraint ( value , field , count ) ;
319
+ const transformedConstraint = transformConstraint ( value , key , field , count ) ;
320
320
if ( transformedConstraint !== CannotTransform ) {
321
321
if ( transformedConstraint . $text ) {
322
322
return { key : '$text' , value : transformedConstraint . $text } ;
@@ -766,19 +766,24 @@ function relativeTimeToDate(text, now = new Date()) {
766
766
// If it is not a valid constraint but it could be a valid something
767
767
// else, return CannotTransform.
768
768
// inArray is whether this is an array field.
769
- function transformConstraint ( constraint , field , count = false ) {
770
- const inArray = field && field . type && field . type === 'Array' ;
769
+ function transformConstraint ( constraint , restKey , field , count = false ) {
771
770
if ( typeof constraint !== 'object' || ! constraint ) {
772
771
return CannotTransform ;
773
772
}
774
- const transformFunction = inArray ? transformInteriorAtom : transformTopLevelAtom ;
773
+
774
+ // transformer
775
+ const inArray = field && field . type && field . type === 'Array' ;
776
+ const inSubDocument = restKey . includes ( '.' ) ;
777
+ const transformFunction =
778
+ inArray || inSubDocument ? transformInteriorAtom : transformTopLevelAtom ;
775
779
const transformer = atom => {
776
780
const result = transformFunction ( atom , field ) ;
777
781
if ( result === CannotTransform ) {
778
782
throw new Parse . Error ( Parse . Error . INVALID_JSON , `bad atom: ${ JSON . stringify ( atom ) } ` ) ;
779
783
}
780
784
return result ;
781
785
} ;
786
+
782
787
// keys is the constraints in reverse alphabetical order.
783
788
// This is a hack so that:
784
789
// $regex is handled before $options
0 commit comments