File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,7 @@ Before you submit your pull request consider the following guidelines:
105
105
` ` `
106
106
Note: the optional commit ` -a` command line option will automatically " add" and " rm" edited files.
107
107
108
- * Build your changes locally to ensure all the tests pass:
109
-
110
- ` ` ` shell
111
- gulp
112
- ` ` `
108
+ * Open the local index.html file in your browser to ensure all the tests pass.
113
109
114
110
* Push your branch to GitHub:
115
111
Original file line number Diff line number Diff line change 12
12
13
13
< script > mocha . setup ( 'bdd' ) </ script >
14
14
15
- < script src ="https://www.gstatic.com/firebasejs/5.5.5 /firebase.js "> </ script >
16
- < script src ="https://www.gstatic.com/firebasejs/5.5.5 /firebase-firestore.js "> </ script >
15
+ < script src ="https://www.gstatic.com/firebasejs/5.9.0 /firebase.js "> </ script >
16
+ < script src ="https://www.gstatic.com/firebasejs/5.9.0 /firebase-firestore.js "> </ script >
17
17
< script src ="test.firestore.js "> </ script >
18
18
< script src ="test.solution-arrays.js "> </ script >
19
19
< script src ="test.solution-counters.js "> </ script >
Original file line number Diff line number Diff line change @@ -423,6 +423,18 @@ describe("firestore", () => {
423
423
// [END update_document_array]
424
424
} ) ;
425
425
426
+ it ( "should update a document using numeric transforms" , ( ) => {
427
+ // [START update_document_increment]
428
+ var washingtonRef = db . collection ( 'cities' ) . doc ( 'DC' ) ;
429
+
430
+ // Atomically increment the population of the city by 50.
431
+ // Note that increment() with no arguments increments by 1.
432
+ washingtonRef . update ( {
433
+ population : firebase . firestore . FieldValue . increment ( 50 )
434
+ } ) ;
435
+ // [END update_document_increment]
436
+ } )
437
+
426
438
it ( "should delete a document" , ( ) => {
427
439
return output =
428
440
// [START delete_document]
@@ -450,6 +462,9 @@ describe("firestore", () => {
450
462
throw "Document does not exist!" ;
451
463
}
452
464
465
+ // Add one person to the city population.
466
+ // Note: this could be done without a transaction
467
+ // by updating the population using FieldValue.increment()
453
468
var newPopulation = sfDoc . data ( ) . population + 1 ;
454
469
transaction . update ( sfDocRef , { population : newPopulation } ) ;
455
470
} ) ;
You can’t perform that action at this time.
0 commit comments