Ember-data filter by has-many


Given the following 2 models:

export default DS.Model.extend({
    slug: DS.attr('string'),
    name: DS.attr('string'),
    username: DS.attr('string'),
    auth: DS.belongsTo('auth', { async: true, inverse: 'user' }),
    avatarImage: DS.belongsTo('image', { async: true }),
    listingEvents: DS.hasMany('listingEvent', { async:true, inverse: 'users' }),
    email: DS.attr('string')


export default DS.Model.extend({
	currentUserAttending: DS.attr(),
  	slug: DS.attr('string'),
	eventInstanceSlug: DS.attr('string'),
  	location: DS.belongsTo('location', { async:true }),
  	artists: DS.hasMany('artist', { async:true }),
  	users: DS.hasMany('user', { async:true })

How can I fetch all listingEvents where users contains a user with id xxxxx

Is this possible?


Depending on your api

you could do store.find(‘listingEvents’, {user: userId}) or you could do store.find(‘user’, userId).get('listingEvents)

Is that what you were asking?