File tree 3 files changed +31
-16
lines changed 3 files changed +31
-16
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,6 @@ class DocumentSnapshot {
217
217
static fromObject ( ref , obj ) {
218
218
return new DocumentSnapshot ( ref , DocumentSnapshot . encodeFields ( obj ) ) ;
219
219
}
220
-
221
220
/**
222
221
* Creates a DocumentSnapshot from an UpdateMap.
223
222
*
@@ -272,7 +271,7 @@ class DocumentSnapshot {
272
271
target [ key ] = childNode ;
273
272
return target ;
274
273
} else {
275
- return null ;
274
+ return ! is . empty ( target ) ? target : null ;
276
275
}
277
276
}
278
277
} else {
Original file line number Diff line number Diff line change @@ -1455,31 +1455,47 @@ describe('update document', function() {
1455
1455
requestEquals (
1456
1456
request ,
1457
1457
update (
1458
- document ( 'foo ' , {
1458
+ document ( 'a ' , {
1459
1459
mapValue : {
1460
1460
fields : {
1461
- bar : {
1462
- stringValue : 'include' ,
1463
- valueType : 'stringValue' ,
1461
+ b : {
1462
+ valueType : 'mapValue' ,
1463
+ mapValue : {
1464
+ fields : {
1465
+ keep : {
1466
+ stringValue : 'keep' ,
1467
+ valueType : 'stringValue' ,
1468
+ } ,
1469
+ } ,
1470
+ } ,
1471
+ } ,
1472
+ c : {
1473
+ valueType : 'mapValue' ,
1474
+ mapValue : {
1475
+ fields : {
1476
+ keep : {
1477
+ stringValue : 'keep' ,
1478
+ valueType : 'stringValue' ,
1479
+ } ,
1480
+ } ,
1481
+ } ,
1464
1482
} ,
1465
1483
} ,
1466
1484
} ,
1467
1485
valueType : 'mapValue' ,
1468
1486
} ) ,
1469
- updateMask ( 'foo.bar ' , 'foo. delete' )
1487
+ updateMask ( 'a.b.delete ' , 'a.b.keep' , 'a.c. delete' , 'a.c.keep ')
1470
1488
)
1471
1489
) ;
1472
1490
1473
1491
callback ( null , writeResult ( 1 ) ) ;
1474
1492
} ;
1475
- return firestore
1476
- . doc ( 'collectionId/documentId' )
1477
- . update (
1478
- 'foo.bar' ,
1479
- 'include' ,
1480
- 'foo.delete' ,
1481
- Firestore . FieldValue . delete ( )
1482
- ) ;
1493
+ return firestore . doc ( 'collectionId/documentId' ) . update ( {
1494
+ 'a.b.delete' : Firestore . FieldValue . delete ( ) ,
1495
+ 'a.b.keep' : 'keep' ,
1496
+ 'a.c.delete' : Firestore . FieldValue . delete ( ) ,
1497
+ 'a.c.keep' : 'keep' ,
1498
+ } ) ;
1483
1499
} ) ;
1484
1500
1485
1501
it ( 'with field with dot ' , function ( ) {
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ describe('Order', function() {
177
177
[ resource ( 'projects/p1/databases/d1/documents/c10/doc1' ) ] ,
178
178
[ resource ( 'projects/p1/databases/dkkkkklkjnjkkk1/documents/c2/doc1' ) ] ,
179
179
[ resource ( 'projects/p2/databases/d2/documents/c1/doc1' ) ] ,
180
- [ resource ( 'projects/p2/databases/d2/documents/cl -/doc1' ) ] ,
180
+ [ resource ( 'projects/p2/databases/d2/documents/c1 -/doc1' ) ] ,
181
181
182
182
// geo points
183
183
[ geopoint ( - 90 , - 180 ) ] ,
You can’t perform that action at this time.
0 commit comments