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

Dontsave hasmany #61

Merged
merged 11 commits into from
Nov 19, 2016
Merged

Dontsave hasmany #61

merged 11 commits into from
Nov 19, 2016

Conversation

jlami
Copy link
Collaborator

@jlami jlami commented Nov 6, 2016

I added an extra option queryInverse to request the hasMany relation to use a query instead of saving the ids.
I added this option so pouch would not need to save the hasMany side. This makes the relation not dependent on the parent document. In my eyes this is more in line with the way couch/pouch wants to edit documents. See my ember-pouch PR for further information.

I also added 2 new api entry calls. findHasMany, to be able to use this query setup from outside of relational-pouch. And parseRelDoc to be able to parse relation pouch documents when getting data from outside of relational-pouch (e.g. from db.find/pouchdb-find). This makes sure all the related documents are being sideloaded if requested by the schema. findHasMany also uses this new parse path, as does the allDocs that _find uses. This way only one code path is required for parsing relational-pouch data.

It might be good to setup the find indexes in this module, instead of in ember-pouch. But ember-pouch does not always give relational-pouch the information on hasMany relations that are async and queried, as those don't need any action from the relational-pouch side. Those still need indexes, so for now I do this in ember-pouch.

@broerse
Copy link
Collaborator

broerse commented Nov 6, 2016

@nolanlawson This is needed to support async relations in ember-data. Like to merge pouchdb-community/ember-pouch#159 to get there.

@jlami
Copy link
Collaborator Author

jlami commented Nov 7, 2016

@broerse Don't know if I would call it suport for async relations. Those are already possible. But not without saving the ids on the hasmany side, which in my opinion has introduced multiple problems.

@nolanlawson
Copy link
Member

@broerse I've made you a contributor on this project and a publisher on the npm package. Unfortunately I don't have much time for relational-pouch or ember-pouch anymore. Sorry for the delay!

@broerse
Copy link
Collaborator

broerse commented Nov 19, 2016

@nolanlawson Thanks! Will try to release a new version today.

@broerse broerse merged commit 7f3b34f into pouchdb-community:master Nov 19, 2016
@broerse
Copy link
Collaborator

broerse commented Nov 19, 2016

@jlami Perhaps reference this new functionality in the readme before I publish a new version? Can you write a PR for this?

@jlami
Copy link
Collaborator Author

jlami commented Nov 19, 2016

@broerse Sure, I'll try to do it this weekend. But no promises ;)

@jlami jlami mentioned this pull request Nov 21, 2016
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.

3 participants