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

天大地大妈咪最大 提交于 2019-12-04 06:15:49

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:

this.store.query('person', { orderBy: 'name', equalTo: 'Peter' });

Although tstirrat's response will get you by in most cases, There is an Ember addon for querying a firebase search.

You can check it out here:

https://www.npmjs.com/package/ember-emberfire-find-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!