Convention for use of PouchDB with CouchDB

1

I'm developing a simple application with pouchDB and couchDB and I have the following doubts:

  • In a normal, relational database (mysql for example) I would have multiple tables. The equivalent structure in pouch / couch would be to create a database for each table? How this would be done.
  • Continuing the above question, assuming that between these mysql tables I have FK relations, what is the best way to do this in pouch / couch?
  • asked by anonymous 13.03.2015 / 12:31

    1 answer

    1

    Hello, the comparison between MySQL and PouchDB is complicated, we are talking about different paradigms between databases. MySQL is a relational database (Entity / Relationship) and PuchDB is non relational (NoSQL). One of the main characteristics of a NoSQL database is to be atomic, since it has no transactional control.

    More about NoSQL

    Comparison table between terms:

    SQL concept     PouchDB concept
    table           no equivalent
    row             document
    column          field
    primary key     primary key (_id)
    index           view
    

    Let's ask your questions:

    1) You would have multiple documents

    2) You would have the relationship (PK) in the same document, such as an array (hobbies):

    {
     "_id": "mittens",
     "name": "Mittens",
     "occupation": "kitten",
     "age": 3,
     "hobbies": [
       "playing with balls of yarn",
       "chasing laser pointers",
       "lookin' hella cute"
     ]
    }
    

    Complete documentation for PouchDB

        
    13.03.2015 / 13:07