GithubHelp home page GithubHelp logo

Comments (4)

nolanlawson avatar nolanlawson commented on July 4, 2024

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.

egoossens avatar egoossens commented on July 4, 2024

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.

nolanlawson avatar nolanlawson commented on July 4, 2024

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.

nolanlawson avatar nolanlawson commented on July 4, 2024

Closing as dup of #24. This is still a serious issue btw.

from relational-pouch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.