Pull request Compare This branch is 6 commits ahead, 146 commits behind Node-8.
nicolasgarnier Upgrade all firebase-admin imports to 5.11.0
Change-Id: Ib3f6a5f57d3fdd0dbc2ee3d27efbd3cf00966257
Latest commit 849ab0b Mar 27, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
functions Upgrade all firebase-admin imports to 5.11.0 Apr 3, 2018
README.md Fixing links Mar 10, 2017


Limit number of child nodes

This template shows how to keep the number of child nodes in a Firebase database below a given number. This can be used to limit the number of lines of a chat history or logs.

Functions Code

See file functions/index.js for the code.

The dependencies are listed in functions/package.json.

Sample Database Structure

As an example we'll be using a simple chat database structure:

            user: "Mat",
            text: "Hey Bob!"
            user: "Bob",
            text: "Hey Mat! What's Up?"

Every time a new chat message is added the Function runs. It counts the number of chat messages and removes the old ones if there are too many.