You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Nicolas Garnier 990a21c3a1 Update text and Firebase version number in package.json 8 years ago
..
functions Update text and Firebase version number in package.json 8 years ago
README.md Some fixes to READMEs and updating imports. 8 years ago

README.md

Tracking the number of elements in a list

This template shows how to keep track of the number of elements in a Firebase Database list. For instance this can be useful to keep tack of the number of "likes" or "followers" of something shared on a social platform.

Functions Code

See file functions/index.js for the code.

This is done by simply updating a likes_count attribute on the parent of the list node which is tracked.

The dependencies are listed in functions/package.json.

Sample Database Structure

As an example we'll be using the database structure shown below. It keeps tracks of the list of users who liked a post and the count of these likes:

/functions-project-12345
    /posts
        /key-123456
            likes_count: 32
            /likes 
                user123456: true
                user456789: true
                user786245: true
                ...