записать функцию облака и обновить количество узлов.
// below function to get the given node count.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.userscount = functions.database.ref('/users/')
.onWrite(event => {
console.log('users number : ', event.data.numChildren());
return event.data.ref.parent.child('count/users').set(event.data.numChildren());
});
См. https://firebase.google.com/docs/functions/database-events
root-- | | -sers (этот узел содержит список всех пользователей) | | -count | -userscount: (этот узел динамически добавлен функцией облака с подсчетом пользователя)