Firebase Functions: How to use second database

20 views Asked by At

How can I initialize my functions to use second database instead of the default one? I use the following code, but noticed a slower response while accessing the database.

const admin = require('firebase-admin');
admin.initializeApp({
  databaseURL: "https://newdatabaseurl"
});
var database = admin.database();

The following code responds slowly:

await database.ref("restRooms").once('value').then(async (snap) => {
     ///some code
});

Connecting to second database invokes the query slowly.

0

There are 0 answers