@@ -13,18 +13,18 @@ async function initializeAppWithProjectId() {
1313 // [START firestore_setup_client_create]
1414 const admin = require ( 'firebase-admin' ) ;
1515
16- admin . initializeApp ( {
16+ initializeApp ( {
1717 // The `projectId` parameter is optional and represents which project the
1818 // client will act on behalf of. If not supplied, it falls back to the default
1919 // project inferred from the environment.
2020 projectId : 'my-project-id' ,
2121 } ) ;
22- const db = admin . firestore ( ) ;
22+ const db = getFirestore ( ) ;
2323 // [END firestore_setup_client_create]
2424 return db ;
2525}
2626
27- async function initializeApp ( ) {
27+ async function initializeAppDefault ( ) {
2828 process . env . GCLOUD_PROJECT = 'firestorebeta1test2' ;
2929 // [START initialize_app]
3030
@@ -249,10 +249,10 @@ async function updateDocumentArray(db) {
249249
250250 // To add or remove multiple items, pass multiple arguments to arrayUnion/arrayRemove
251251 const multipleUnionRes = await washingtonRef . update ( {
252- regions : admin . firestore . FieldValue . arrayUnion ( 'south_carolina' , 'texas' )
252+ regions : FieldValue . arrayUnion ( 'south_carolina' , 'texas' )
253253 // Alternatively, you can use spread operator in ES6 syntax
254254 // const newRegions = ['south_carolina', 'texas']
255- // regions: admin.firestore. FieldValue.arrayUnion(...newRegions)
255+ // regions: FieldValue.arrayUnion(...newRegions)
256256 } ) ;
257257 // [END firestore_data_set_array_operations]
258258
@@ -953,8 +953,8 @@ async function deleteQueryBatch(db, query, resolve) {
953953
954954describe ( 'Firestore Smoketests' , ( ) => {
955955
956- const app = admin . initializeApp ( { } , 'tests' ) ;
957- const db = admin . firestore ( app ) ;
956+ const app = initializeApp ( { } , 'tests' ) ;
957+ const db = getFirestore ( app ) ;
958958
959959 it ( 'should initialize a db with the default credential' , ( ) => {
960960 return initializeApp ( ) ;
0 commit comments