File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1182,7 +1182,7 @@ class DocumentMask {
1182
1182
applyTo ( data ) {
1183
1183
/*!
1184
1184
* Applies this DocumentMask to 'data' and computes the list of field paths
1185
- * that were specified in the mask but not present in 'data'.
1185
+ * that were specified in the mask but are not present in 'data'.
1186
1186
*/
1187
1187
const applyDocumentMask = data => {
1188
1188
const remainingPaths = this . _sortedPaths . slice ( 0 ) ;
@@ -1210,7 +1210,8 @@ class DocumentMask {
1210
1210
return result ;
1211
1211
} ;
1212
1212
1213
- const filteredData = processObject ( data ) ;
1213
+ // processObject() returns 'null' if the DocumentMask is empty.
1214
+ const filteredData = processObject ( data ) || { } ;
1214
1215
1215
1216
return {
1216
1217
filteredData : filteredData ,
Original file line number Diff line number Diff line change @@ -1038,6 +1038,15 @@ describe('set document', function() {
1038
1038
) ;
1039
1039
} ) ;
1040
1040
1041
+ it ( 'supports document merges with empty field mask' , function ( ) {
1042
+ firestore . api . Firestore . _commit = function ( request , options , callback ) {
1043
+ requestEquals ( request , set ( document ( ) , updateMask ( ) ) ) ;
1044
+ callback ( null , writeResult ( 1 ) ) ;
1045
+ } ;
1046
+
1047
+ return firestore . doc ( 'collectionId/documentId' ) . set ( { } , { mergeFields : [ ] } ) ;
1048
+ } ) ;
1049
+
1041
1050
it ( 'supports document merges with field mask and empty maps' , function ( ) {
1042
1051
firestore . api . Firestore . _commit = function ( request , options , callback ) {
1043
1052
requestEquals (
You can’t perform that action at this time.
0 commit comments