@@ -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 , field , count , key ) ;
320
320
if ( transformedConstraint !== CannotTransform ) {
321
321
if ( transformedConstraint . $text ) {
322
322
return { key : '$text' , value : transformedConstraint . $text } ;
@@ -561,8 +561,6 @@ const transformInteriorAtom = atom => {
561
561
} ;
562
562
} else if ( typeof atom === 'function' || typeof atom === 'symbol' ) {
563
563
throw new Parse . Error ( Parse . Error . INVALID_JSON , `cannot transform value: ${ atom } ` ) ;
564
- } else if ( DateCoder . isValidJSON ( atom ) ) {
565
- return DateCoder . JSONToDatabase ( atom ) ;
566
564
} else if ( BytesCoder . isValidJSON ( atom ) ) {
567
565
return BytesCoder . JSONToDatabase ( atom ) ;
568
566
} else if ( typeof atom === 'object' && atom && atom . $regex !== undefined ) {
@@ -766,12 +764,15 @@ function relativeTimeToDate(text, now = new Date()) {
766
764
// If it is not a valid constraint but it could be a valid something
767
765
// else, return CannotTransform.
768
766
// inArray is whether this is an array field.
769
- function transformConstraint ( constraint , field , count = false ) {
767
+ function transformConstraint ( constraint , field , count = false , restKey ) {
770
768
const inArray = field && field . type && field . type === 'Array' ;
771
769
if ( typeof constraint !== 'object' || ! constraint ) {
772
770
return CannotTransform ;
773
771
}
774
- const transformFunction = inArray ? transformInteriorAtom : transformTopLevelAtom ;
772
+ // if key points to nested attribute, we don't want to transform types other than Bytes, so that we're consistent with
773
+ // how we're saving nested attributes
774
+ const transformFunction =
775
+ inArray || ( restKey && restKey . includes ( '.' ) ) ? transformInteriorAtom : transformTopLevelAtom ;
775
776
const transformer = atom => {
776
777
const result = transformFunction ( atom , field ) ;
777
778
if ( result === CannotTransform ) {
0 commit comments