Comments (4)
Yeah, I believe I designed this thing such that relations have to be mutual - if they are inconsistent between parent and child, then weird stuff starts to happen. IIRC Ember Data also has this design property.
I can't think of a reasonable way to resolve it except to either say that 1) parents always win, 2) children always win, or 3) you have to keep the two in sync, and too bad if you don't. Out of curiosity, is this an issue you ran into in the wild?
from relational-pouch.
Yes I'm building an object class based on PouchDB and relational-pouch. In my Obj#delete method I first removed the reference to the to-be-deleted object from its parents (belongsTo) and then wanted to actually delete it from the pouch using the find/del pattern. That's where the find failed and I got this behavior. I got it to work by doing the reverse. It also worked by deleting using the base PouchDB methods (get/deleted=true/put).
I understand this is an errory case but as I ran into it I just wanted to have your opinion. My opinion is that a find should always at least return what you're trying to find (if it's there), maybe omitting the related docs if the relation is broken.
A side question, do you know a piece of software that does what I'm trying to build, i.e. provide an object that has methods to do CRUD taking relations into account (like ActiveRecord in Rails) but with Couch/Pouch as the data source?
On 29 Aug 2015, at 03:44, Nolan Lawson [email protected] wrote:
Yeah, I believe I designed this thing such that relations have to be mutual - if they are inconsistent between parent and child, then weird stuff starts to happen. IIRC Ember Data also has this design property.
I can't think of a reasonable way to resolve it except to either say that 1) parents always win, 2) children always win, or 3) you have to keep the two in sync, and too bad if you don't. Out of curiosity, is this an issue you ran into in the wild?
—
Reply to this email directly or view it on GitHub.
from relational-pouch.
No, relational-pouch is the only one I'm aware of. Also, I should note that CouchDB veterans will tell you that, when you're trying to store relational data in CouchDB, you need to resolve any inconsistencies at query time anyway, because e.g. what happens if there's a sync conflict in a child but not in a parent? Or what if replication occurs, and the parent replicates before the child but a user query occurs before the child has replicated?
I admit I did not do a great job of solving these problems in this plugin - e.g. see #24. If you'd like to contribute the fix, though, I'd be happy to accept it. :) Looks like you've already got a test to reproduce it, which is awesome; as for how to fix it, I would lean towards whatever Ember Data does to solve this problem, because 99% of the users of this plugin are via ember-pouch
.
from relational-pouch.
Closing as dup of #24. This is still a serious issue btw.
from relational-pouch.
Related Issues (20)
- Dead link in documentation HOT 1
- Heelp!!!! new post not adding to authors HOT 2
- Depreciate IE8 support HOT 1
- Delete all schema docs.
- Is db.rel.find() have an option for paging? HOT 12
- How to use 'pouchdb-validation' and 'relational-pouch'?
- How does the sync performance of this compare to vanilla pouchdb?
- Handling error while saving Relational data
- Handling ECONNRESET HOT 4
- don't save hasMany/queryInverse with many-to-many HOT 2
- find and delete by id not working
- find action, slow performance HOT 2
- db.rel.findHasMany is not working HOT 3
- [help] CouchDb 3.0 - Partitioned Databases HOT 5
- Delete successful but data has not removed HOT 2
- How to return _conflicts attribute HOT 1
- how to get sort data? HOT 1
- why pouchdb.rel.find() works only with integer id? HOT 6
- React Native app crashes when try to import
- Confused about "hasMany" relationship (see description below) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relational-pouch.