pouchdb-community / ember-pouch

PouchDB/CouchDB adapter for Ember Data
Apache License 2.0
281 stars 76 forks source link

query returns different types of models, instead of single specified one #258

Open adezegher opened 4 years ago

adezegher commented 4 years ago

When executing a query for a specific model, the query can return a result with other models than specified.

Example:

Following is expected to only return models of type house but will actually return data of both models house and person:

this.store.query('house',  { filter: { title: {$regex: ".*"} } });

Models:


// app/models/house.js
import { attr } from '@ember-data/model';
import { Model } from 'ember-pouch';

export default class HouseModel extends Model {
  @attr('string') title;

}

// app/models/person.js
import { attr } from '@ember-data/model';
import { Model } from 'ember-pouch';

export default class PersonModel extends Model {
  @attr('string') title;
}

Environment

DEBUG: Ember           : 3.17.3
DEBUG: Ember Data      : 3.17.0
DEBUG: Ember Pouch     : 7.0.0
backspace commented 4 years ago

Thanks for pointing this out. Did you have any success with addressing this in these linked commits, @adezegher? It would be preferable to include a test for this any fix, too.

adezegher commented 4 years ago

@backspace the fix in PR #260 worked fine for me. I got pulled into something else so never got to fully debug why the tests were failing.