@@ -13,18 +13,18 @@ async function initializeAppWithProjectId() {
13
13
// [START firestore_setup_client_create]
14
14
const admin = require ( 'firebase-admin' ) ;
15
15
16
- admin . initializeApp ( {
16
+ initializeApp ( {
17
17
// The `projectId` parameter is optional and represents which project the
18
18
// client will act on behalf of. If not supplied, it falls back to the default
19
19
// project inferred from the environment.
20
20
projectId : 'my-project-id' ,
21
21
} ) ;
22
- const db = admin . firestore ( ) ;
22
+ const db = getFirestore ( ) ;
23
23
// [END firestore_setup_client_create]
24
24
return db ;
25
25
}
26
26
27
- async function initializeApp ( ) {
27
+ async function initializeAppDefault ( ) {
28
28
process . env . GCLOUD_PROJECT = 'firestorebeta1test2' ;
29
29
// [START initialize_app]
30
30
@@ -249,10 +249,10 @@ async function updateDocumentArray(db) {
249
249
250
250
// To add or remove multiple items, pass multiple arguments to arrayUnion/arrayRemove
251
251
const multipleUnionRes = await washingtonRef . update ( {
252
- regions : admin . firestore . FieldValue . arrayUnion ( 'south_carolina' , 'texas' )
252
+ regions : FieldValue . arrayUnion ( 'south_carolina' , 'texas' )
253
253
// Alternatively, you can use spread operator in ES6 syntax
254
254
// const newRegions = ['south_carolina', 'texas']
255
- // regions: admin.firestore. FieldValue.arrayUnion(...newRegions)
255
+ // regions: FieldValue.arrayUnion(...newRegions)
256
256
} ) ;
257
257
// [END firestore_data_set_array_operations]
258
258
@@ -953,8 +953,8 @@ async function deleteQueryBatch(db, query, resolve) {
953
953
954
954
describe ( 'Firestore Smoketests' , ( ) => {
955
955
956
- const app = admin . initializeApp ( { } , 'tests' ) ;
957
- const db = admin . firestore ( app ) ;
956
+ const app = initializeApp ( { } , 'tests' ) ;
957
+ const db = getFirestore ( app ) ;
958
958
959
959
it ( 'should initialize a db with the default credential' , ( ) => {
960
960
return initializeApp ( ) ;
0 commit comments