I am new to ember.js and firebase. I tried to do what I needed to query the DB for the key corresponding to a specific value.
According to guides.emberjs.com , the following example should work:
this.store.query('person', { filter: { name: 'Peter' } }).then(function(peters) {
But this is not so. Apparently, because I use hadron fire. After literal hours of browsing the Internet, there was no clear solution.
emberfire docs talk about the available arguments.
Arguments
orderBy - String - Property ...
.
.
,
equalTo - String, Number, Null - creates a query that includes children that match the specified value.
And imagine an example ...
// app/routes/dinosaurs.js export default Ember.Route.extend({ model: function() { return this.store.find('dinosaur', { orderBy: 'height', limitToLast: 10, startAt: 5 }); } });
Although not shown how to use "equalTo". I tested them all, but I did not understand how equalTo works.
There are other solutions in SO, but they are all pre-v2.0.0. Therefore, I do not think that they will work post v2.0.0.
Ember.js Debug Information:
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: -------------------------------
Database Used: https://shoutoutdb.firebaseio.com/users
I donβt quite understand how equalTo should work here, but I donβt understand either. Hope someone here wants to help.
If you think that the question needs some improvement, we ask you to ask. I described this in detail, as I thought I should. Thank you in advance.:)
EDIT: The code I tried to use:
$E.store.find('user',{name:'Alpha'}).then( function (data) {
I also tried several different versions of this code. Nothing worked, so I don't think it's worth mentioning them here.