You're viewing the legacy docs. They are deprecated as of May 18, 2016.
These docs are for version 2.4.2 and below of the Javascript SDK. Go to our current docs, or see our Web migration guide.

Short Code Snippets

JavaScript Recipes

This page includes a list of small code snippets and recipes that we maintain. These resources are geared to help you learn Firebase or speed up development.

Name Description
Checking for data This snippet detects if a user ID is already taken an is an example of checking for the existence of data.
Finding a user by email An example of searching for user accounts by email address.
Implementing role-based security Using your Firebase data structure as a basis for your Security and Firebase Rules.
Get first list item Retrieve only the first item in a list.
Getting only new items Retrieves only items added in the future.
Extracting claims from a JWT A helper function to extract claims from a JWT.
Creating data if it doesn't exist How to create a user only if it doesn't already exist.
Assigning players in a multiplayer game How to assign players spots in a game if the game isn't full yet.
Removing a pushed item How to remove an object you've just added using push().
Getting the parent of a snapshot Getting the parent object of a Firebase snapshot.