Skip to content

Commit

Permalink
Merge pull request #197 from pouchdb-community/revert-194-filter-resu…
Browse files Browse the repository at this point in the history
…lts-by-type

Revert "filter results of pouch adapter query by correct type"
  • Loading branch information
broerse authored Sep 13, 2017
2 parents ffb79cc + ed0133e commit f132f6a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions addon/adapters/pouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,7 @@ export default DS.RESTAdapter.extend({
queryParams.sort = this._buildSort(query.sort);
}

var idType = type.documentType || recordTypeName;
var recordTypeNameRegex = new RegExp('^' + idType + '_[0-3]');

return db.find(queryParams)
.then(function({ docs }) {
let matchinDocs = docs.filter(({ _id }) => _id.match(recordTypeNameRegex));
return { docs: matchinDocs };
})
.then(pouchRes => db.rel.parseRelDocs(recordTypeName, pouchRes.docs));
return db.find(queryParams).then(pouchRes => db.rel.parseRelDocs(recordTypeName, pouchRes.docs));
},

queryRecord: function(store, type, query) {
Expand Down

0 comments on commit f132f6a

Please sign in to comment.