Socket
Socket
Sign inDemoInstall

firebase-where

Package Overview
Dependencies
7
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    firebase-where

Simple, efficient 'where' filtering in Firebase


Version published
Maintainers
1
Created

Readme

Source

firebase-where (Experimental!)

Ever wanted to search users, posts, or anything in a firebase with a "where" filter? So did we! That's why we made firebase-where. The easiest way to index and find your Firebase data. Oh, and it's pretty darn efficient at it too (only loads data which matches query and some indexing data)!

Example

// Create a normal ref
var ref = new Firebase(URL);
// Set up our where (which will write to /_index in your Firebase
var firebaseWhere = new FirebaseWhere(ref);

// Add some children
firebaseWhere.child('users/abe').setWithIndex({username: 'abe', color: 'red', town: 'sf'});
firebaseWhere.child('users/joe').setWithIndex({username: 'joe', color: 'pink', town: 'bl'});
firebaseWhere.child('users/jacki').setWithIndex({username: 'jacki', color: 'pink', town: 'bl'});

// Watch for users who are in BL and whose color is pink.
firebaseWhere.onWithQuery("child_added", {town: 'bl', color: 'pink'}, function (snapshot) {
  console.log(snapshot.val()); // Will trigger for Joe and Jacki
});

// Adding more children
firebaseWhere.child('users/nate').setWithIndex({username: 'nate', color: 'red', town: 'el'});    // Wont trigger event :(
firebaseWhere.child('users/becki').setWithIndex({username: 'becki', color: 'pink', town: 'bl'}); // Will trigger event :)

Credits

Although he did not directly work on firebase-where, all high-fives for this should go to Michael Wulf. Without his FirebaseIndex and his/Firebase's firebase-util libraries, this would have been an exponentially larger project.

Development of this library is sponsored by Rigidflame Consultants.

FAQs

Last updated on 21 May 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc