How to use emberfire to query a firebase db for all items with name equalTo xyz in ember.js 2.0.0?

Asked By: Anonymous

I’m new to ember.js and firebase.
I’ve been trying to make something that needs me to query the DB for a key matching a defined value.

According to, the following example should work:'person', { filter: { name: 'Peter' } }).then(function(peters) {
  // Do something with `peters`

But it doesn’t. Apparently because I’m using the emberfire addon.
After literally hours of googling, there was no clear solution.

The emberfire docs talk about the available arguments.


orderByString – The property …

equalToString, Number, Null – Creates a query which includes children which match the specified value.

And present an example…

// app/routes/dinosaurs.js
export default Ember.Route.extend({
  model: function() {
    return'dinosaur', {
      orderBy: 'height',
      limitToLast: 10,
      startAt: 5

Although without showing how to use ‘equalTo’.
I’ve tested all of them, but I failed to understand how equalTo works.

There are other solutions on SO about this, but they are all pre-v2.0.0. So I don’t think they would work post v2.0.0.

Ember.js debug info:

DEBUG: -------------------------------
DEBUG: Ember      : 2.0.0
DEBUG: Ember Data : 2.0.0
DEBUG: Firebase   : 2.3.1
DEBUG: EmberFire  : 1.6.0
DEBUG: jQuery     : 1.11.3
DEBUG: -------------------------------

The database in use:

I don’t fully understand how equalTo should work here, but I’m not getting any clue either. Hopefully someone here will be willing to help.

If you think the question needs any kind of improvement, kindly ask. I’ve detailed it as well as I thought I should.
Thanks in advance. 🙂

Code I tried to use:

    function (data) {
       //stuff done with the data

I also tried multiple different versions around this code. Nothing worked, so I don’t think it’s even worth mentioning them here.


Answered By: Anonymous

Using the querying capabilities you can combine orderByChild and equalTo to get the desired result:

ref.child('people').orderByChild('name').equalTo('Peter').on('value', ...);

There is an example in the web API reference for equalTo and in the Web guide on complex queries.

So, in EmberFire, this would translate to the following:'person', { orderBy: 'name', equalTo: 'Peter' });

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen Windows 10 Lisans Office 2019 Mac Satın Al follower kaufen instagram follower kaufen porno