The fact that CouchDB is a document based database does not mean you cannot model relations with it when it makes sense. Am 13.06.2015 11:10 schrieb "Ram Rachum" <[email protected]>:
> I read this: > http://docs.ehealthafrica.org/couchdb-best-practices/#one-to-n-relations > > Is this how I'm supposed to use CouchDB? Because isn't this relational? I > think that if I'm pushing CouchDB to be like PostgreSQL, then maybe I'm > doing it wrong and I should either use PostgreSQL idiomatically or CouchDB > idiomatically. > > On Sat, Jun 13, 2015 at 11:37 AM, Johannes Jörg Schmidt < > [email protected]> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA256 > > > > Please read the sections "One To N Relations" [1], "N To N Relations" > > [2] and "Linked Documents" [3] from CouchDB Best Practices. > > > > tl;dr you can and should link documents. > > > > [1]: > > http://docs.ehealthafrica.org/couchdb-best-practices/#one-to-n-relations > > [2]: > > http://docs.ehealthafrica.org/couchdb-best-practices/#n-to-n-relations > > [3]: > > http://docs.ehealthafrica.org/couchdb-best-practices/#linked-documents > > > > On 13.06.2015 10:13, Ram Rachum wrote: > > > Question: If it's schemaless, what do you do for foreign keys? > > > Whenever I design a project, there's tons of foreign key. You have > > > a user, and then he has objects associated with him, and then they > > > have objects associated with them, etc. What do you do when you're > > > using CouchDB. Foreign keys aren't idiomatic to CouchDB, right? > > > > > > On Sat, Jun 13, 2015 at 6:07 AM, Joel Wallis <[email protected]> > > > wrote: > > > > > >> Ram, there's nothing between Python and CouchDB. You can just > > >> make a simple search in the Python community to discover > > >> alternatives to interact with CouchDB! Also, CouchDB's interface > > >> is REST, so you probably already knows how to use it. > > >> > > >> PostgreSQL is very different than CouchDB. PostgreSQL is a > > >> relational database with a wonderful SQL environment, and CouchDB > > >> is a NoSQL/schemaless document-based database. Replication and > > >> scalability in PostgreSQL is not so simple, although with CouchDB > > >> its master-master simplicity is a core feature > > >> <http://docs.couchdb.org/en/1.6.1/replication/intro.html>. > > >> There's a big gap between them. > > >> > > >> I believe you must choose your database technology based in your > > >> project needs/reality, so take a look at these aspects and tell > > >> yourself which technology would fit your project needs. > > >> > > >> 2015-06-12 13:48 GMT-03:00 Ram Rachum <[email protected]>: > > >> > > >>> To be honest, in my experience when you use something through > > >>> an adapter you always have to deal with more problems. So I'd > > >>> prefer to avoid using > > >> a > > >>> Python library that talks to a JavaScript library. Also it > > >>> seems that > > >> undo > > >>> isn't core functionality for PouchDB, I saw a separate repo for > > >>> it. I > > >> would > > >>> have preferred to have it as core functionality. I think I'll > > >>> just stick with Postgres. Thanks for your help! > > >>> > > >>> On Fri, Jun 12, 2015 at 7:30 PM, Johannes Jörg Schmidt < > > >>> [email protected] > > >>>> wrote: > > >>> > > > Hi Ram, > > > > > > there is Python-PouchDB, which brings PouchDB to the Python land. > > > I did not tried it but it sounds interesting: > > > https://pythonhosted.org/Python-PouchDB/ > > > > > > Johannes > > > > > > On 12.06.2015 18:16, Ram Rachum wrote: > > >>>>>> Hi Joel, > > >>>>>> > > >>>>>> Thanks for the tip. But if I use PouchDB does it mean > > >>>>>> that I need to use JavaScript? I'm very experienced with > > >>>>>> Python, and hardly experienced with JavaScript. This > > >>>>>> application is going to have lots of parts and logic to > > >>>>>> it besides this feature, and I'd hate to have to program > > >>>>>> the whole thing in JavaScript just because of PouchDB. > > >>>>>> > > >>>>>> > > >>>>>> Thanks, Ram. > > >>>>>> > > >>>>>> On Fri, Jun 12, 2015 at 6:45 PM, Joel Wallis > > >>>>>> <[email protected]> wrote: > > >>>>>> > > >>>>>>> PS: PouchDB is a client-side JavaScript library that > > >>>>>>> also runs with Node.js. It creates a database on > > >>>>>>> client-side (using IndexedDB, WebSQL, or other storage > > >>>>>>> strategies like localStorage or SQLite by adding > > >>>>>>> plugins to it) with the ability to sync data with > > >>>>>>> CoudhDB - or a CouchDB-compatible version of PouchDB > > >>>>>>> called pouchdb-server (a separated project). > > >>>>>>> > > >>>>>>> http://pouchdb.com/ :-) > > >>>>>>> > > >>>>>>> 2015-06-12 12:42 GMT-03:00 Joel Wallis > > >>>>>>> <[email protected]>: > > >>>>>>> > > >>>>>>>> You need PouchDB. Write your app with NW.js and this > > >>>>>>>> feature will be trivial to implement. > > >>>>>>>> > > >>>>>>>> 2015-06-12 8:02 GMT-03:00 Roald de Vries > > >>>>>>>> <[email protected]>: > > >>>>>>>> > > >>>>>>>>> > > >>>>>>>>>> On 12 Jun 2015, at 12:55, Ram Rachum > > >>>>>>>>>> <[email protected]> wrote: > > >>>>>>>>> > > >>>>>>>>>> So if I'll want undo functionality, I'll have to > > >>>>>>>>>> create my own log > > >>>>>>>>> separate > > >>>>>>>>>> from CouchDB's native log? > > >>>>>>>>> > > >>>>>>>>> For example. I’m not sure if there are other > > >>>>>>>>> standard solutions to this (pretty common) > > >>>>>>>>> problem. > > >>>>>>>> > > >>>>>>>> > > >>>>>>>> > > >>>>>>>> > > >>>>>>>> -- Joel Wallis Jucá joelwallis.com > > >>>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> -- Joel Wallis Jucá joelwallis.com > > >>>>>>> > > >>>>>> > > > > > >>>> > > >>> > > >> > > >> > > >> > > >> -- Joel Wallis Jucá joelwallis.com > > >> > > > > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v2 > > > > iQEcBAEBCAAGBQJVe+vmAAoJED+W7gN+c0gcOoYH/34mRHI6slCfVIucHaGZLNwc > > tgDzFDsorcbSlskCY/pnlzYjJ5QYuwxkQbWzBPrz4ZhvcXktmn0odghwk3D/bsOF > > s3H8JFegIJ5IM75o0cCbg0wmR3nQlO+g5qxANuNs3VFElMhJMuyUlhf/UoTK2bnj > > RZIVcN/gW05IfVxYHHNoTYJ7t2306U4LafSGOg55vru3peZuJ8M/Lditdy1wNDCm > > o2TgNj9qM4i2nOLNkYevWp4lhhiAhWVh9Pn1/8WkxbwuzWNFn78qA2xLvnd4an7S > > 2Ia/Jnm0koOHkUBr7IzN0b3acV1bRfXIVjxGWv/aJseuLdZ6I3VFVh2C3IYoiQk= > > =m+Z8 > > -----END PGP SIGNATURE----- > > >
