Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement glue code for query and queryRecord using pouchdb-find #130

Merged
merged 30 commits into from
Sep 4, 2016

Conversation

BernardTolosajr
Copy link
Contributor

Usage:
MyModel.query({selector: { name: "Mario" }, sort: ["name"]})
MyModel.query({selector: {debut: {$gte: 1990}})
MyModel.query({selector: { series: "Mario" }, sort: [{series: "desc"}, {debut: "desc"}]})
MyModel.queryRecord({selector: { name: "Mario" }})

@simonexmachina
Copy link
Collaborator

@BernardTolosajr and @nolanlawson, can I get an update on the status of this PR please. I'm doing a tidy-up pass through our PRs.

@nolanlawson
Copy link
Member

I'm not really maintaining ember-pouch anymore because of a lack of time. As for pouchdb-find compatibility with relational-pouch/ember-pouch I'd say I'm very skeptical that it could work well although this PR looks to me like about the best possible way to do it.

My only major feedback is that I had kind of hoped pouchdb-find functionality could be rolled into relational-pouch rather than ember-pouch, but as I said I basically have zero time for this project anymore, so my opinion probably matters very little at this point. 😅

@simonexmachina
Copy link
Collaborator

@BernardTolosajr I think that @nolanlawson raises a good point here. This functionality probably belongs in relational-pouch. Are you at all interested in adding it there? @nolanlawson are there many users of relational-pouch outside ember-pouch? @broerse what do you think about adding this functionality into ember-pouch?

@BernardTolosajr
Copy link
Contributor Author

BernardTolosajr commented Sep 2, 2016

@aexmachina Sure, i will check on this.

@broerse
Copy link
Collaborator

broerse commented Sep 2, 2016

@BernardTolosajr @aexmachina I think because ember-pouch is the "interface" for ember-data this functionality needs to be in this module. If pouchdb-find is merged into relational-pouch or something ember-pouch still needs to facilitate this. So perhaps lets merge this.

@nolanlawson
Copy link
Member

@nolanlawson are there many users of relational-pouch outside ember-pouch?

@aexmachina npm says 325 downloads in the past month for relational-pouch vs 866 for ember-pouch (not even sure how that's possible? maybe transitive deps aren't counted?) but yeah, corresponds roughly to my feeling, which is that ember-pouch is about 3x more popular than relational-pouch.

In any case, my goal with relational-pouch was to isolate the "pouch-y" stuff into that repo, and the "ember-y" stuff into this repo. In my mind, pouchdb-find falls squarely in the "pouch-y" part, hence my comment.

OTOH maybe it makes sense to have ember-pouch just directly depend on relational-pouch and pouchdb-find. I'm fine with that too, if folks feel that it solves a real problem and isn't an unwieldy maintenance burden.

@broerse
Copy link
Collaborator

broerse commented Sep 3, 2016

@BernardTolosajr I like to merge this. Can you fix the conflicts?

@BernardTolosajr
Copy link
Contributor Author

BernardTolosajr commented Sep 4, 2016

@broerse Sure, fixed conflicts.

@fsmanuel
Copy link
Collaborator

fsmanuel commented Sep 4, 2016

@BernardTolosajr 👍 I really like what you did but can we change selector to filter to be closer to the JSON::API Spec and make it easier for people to change adapters as they need?

@broerse
Copy link
Collaborator

broerse commented Sep 4, 2016

@BernardTolosajr I also think changing selector to filter is better.

@BernardTolosajr
Copy link
Contributor Author

@fsmanuel Thanks! yup filter is better. @broerse 👍

@broerse broerse merged commit 96e93d3 into pouchdb-community:master Sep 4, 2016
return row.data;
}
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will yield undefined elements in the array if there's no id. Is this what you want? Maybe you should use reduce?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad i did not anticipate missing id here, ill check on this using reduce.

@broerse
Copy link
Collaborator

broerse commented Sep 4, 2016

@BernardTolosajr @aexmachina Good catch. Fix this in a new PR. Add test?

@BernardTolosajr
Copy link
Contributor Author

@broerse 👍 ill submit a new PR.

@BernardTolosajr
Copy link
Contributor Author

@aexmachina @broerse upon initial testing for missing id found out that pouchdb auto-generate the _id if its not provided.

@broerse
Copy link
Collaborator

broerse commented Sep 6, 2016

@aexmachina @BernardTolosajr Nice! I wil release 4.0.0 then. Thanks!

@simonexmachina
Copy link
Collaborator

@BernardTolosajr okay cool, but I still think that the mapper should be updated. Also, upgrading to v4.0.0 breaks the app because bower_components/pouchdb-find/dist/pouchdb.find.js is not installed. Maybe we should include upgrade instructions to the changelog?

@broerse
Copy link
Collaborator

broerse commented Sep 6, 2016

@aexmachina no it was some typo junk. v4.0.1 fixes this

@simonexmachina
Copy link
Collaborator

I'm running v4.0.1 and ember serve fails unless I add pouchdb-find to bower.json.

@broerse
Copy link
Collaborator

broerse commented Sep 6, 2016

@aexmachina but you did not run ember install ember-pouch ;-)

@simonexmachina
Copy link
Collaborator

@broerse okay, that is the right way to upgrade an ember addon isn't it :)

@BernardTolosajr BernardTolosajr deleted the implement-query branch September 23, 2016 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants