Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PouchDB structure

i am new with nosql concept, so when i start to learn PouchDB, i found this conversion chart. My confusion is, how PouchDB handle if lets say i have multiple table, does it mean that i need to create multiple databases? Because from my understanding in pouchdb a database can store a lot of documents, but a document mean a row in sql or am i misunderstood?

enter image description here

like image 395
Sufi Avatar asked May 06 '15 03:05

Sufi


People also ask

Is PouchDB a NoSQL?

PouchDB is an open-source, NoSQL, in-line database. It is designed after CouchDB, which is a NoSQL database that powers npm.

How does PouchDB store data?

In PouchDB, when the application is offline, the data is stored locally using WebSQL and IndexedDB in the browser. When the application is back online, it is synchronized with CouchDB and compatible servers.


1 Answers

The answer to this question seems to be surprisingly under-documented. While @llabball clearly gave a decent answer, I don't think that views are always the way to go.

As you can read here in the section When not to use map/reduce, Nolan explains that for simpler applications, the key is to abuse _ids, and leverage the power of allDocs().

In other words, if you had two separate types (say artists, and albums), then you could prefix the id of each type to obtain an easily searchable data set. For example _id: 'artist_name' & _id: 'album_title', would allow you to easily retrieve artists in name order.

Laying out the data this way will result in better performance due to not requiring extra indexes, and less code. Clearly however, if your data requirements are more complex, then views are the way to go.

like image 130
Matt Way Avatar answered Nov 09 '22 11:11

Matt Way