@@ -601,6 +601,7 @@ class ParseQuery {
601
601
* <li>sessionToken: A valid session token, used for making a request on
602
602
* behalf of a specific user.
603
603
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
604
+ * <li>json: Return raw json without converting to Parse.Object
604
605
* </ul>
605
606
*
606
607
* @returns {Promise } A promise that is resolved with the result when
@@ -619,6 +620,9 @@ class ParseQuery {
619
620
if ( options && options . hasOwnProperty ( 'context' ) && typeof options . context === 'object' ) {
620
621
firstOptions . context = options . context ;
621
622
}
623
+ if ( options && options . hasOwnProperty ( 'json' ) ) {
624
+ firstOptions . json = options . json ;
625
+ }
622
626
623
627
return this . first ( firstOptions ) . then ( response => {
624
628
if ( response ) {
@@ -640,6 +644,7 @@ class ParseQuery {
640
644
* <li>sessionToken: A valid session token, used for making a request on
641
645
* behalf of a specific user.
642
646
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
647
+ * <li>json: Return raw json without converting to Parse.Object
643
648
* </ul>
644
649
*
645
650
* @returns {Promise } A promise that is resolved with the results when
@@ -686,8 +691,11 @@ class ParseQuery {
686
691
if ( select ) {
687
692
handleSelectResult ( data , select ) ;
688
693
}
689
-
690
- return ParseObject . fromJSON ( data , ! select ) ;
694
+ if ( options . json ) {
695
+ return data ;
696
+ } else {
697
+ return ParseObject . fromJSON ( data , ! select ) ;
698
+ }
691
699
} ) ;
692
700
693
701
const count = response . count ;
@@ -849,6 +857,7 @@ class ParseQuery {
849
857
* <li>sessionToken: A valid session token, used for making a request on
850
858
* behalf of a specific user.
851
859
* <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
860
+ * <li>json: Return raw json without converting to Parse.Object
852
861
* </ul>
853
862
*
854
863
* @returns {Promise } A promise that is resolved with the object when
@@ -900,8 +909,11 @@ class ParseQuery {
900
909
if ( select ) {
901
910
handleSelectResult ( objects [ 0 ] , select ) ;
902
911
}
903
-
904
- return ParseObject . fromJSON ( objects [ 0 ] , ! select ) ;
912
+ if ( options . json ) {
913
+ return objects [ 0 ] ;
914
+ } else {
915
+ return ParseObject . fromJSON ( objects [ 0 ] , ! select ) ;
916
+ }
905
917
} ) ;
906
918
}
907
919
0 commit comments