{"id":8110,"date":"2015-11-26T13:40:34","date_gmt":"2015-11-26T13:40:34","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/26\/pouchdb-structure-open-source-projects-pouchdb-pouchdb\/"},"modified":"2022-08-30T15:03:00","modified_gmt":"2022-08-30T15:03:00","slug":"pouchdb-structure-open-source-projects-pouchdb-pouchdb","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/26\/pouchdb-structure-open-source-projects-pouchdb-pouchdb\/","title":{"rendered":"PouchDB structure-open source projects pouchdb\/pouchdb"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5aef9acda8a2590cdc14118cd8f1322e?s=128&amp;d=identicon&amp;r=PG\" \/> <strong>llabball<\/strong><\/p>\n<blockquote>\n<p>&#8230; does it mean that i need to create multiple databases?<\/p>\n<\/blockquote>\n<p>No.<\/p>\n<blockquote>\n<p>&#8230; a document mean a row in sql or am i misunderstood?<\/p>\n<\/blockquote>\n<p>That&#8217;s right. The SQL table defines column header (name and type) &#8211; that are the JSON property names of the doc.<\/p>\n<p>So, all docs (rows) <strong>with the same properties<\/strong> (a so called &#8220;schema&#8221;) are the equivalent of your SQL table. You can have as much different schemata in one database as you want (visit json-schema.org for some inspiration).<\/p>\n<p>How to request them separately? Create CouchDB views! You can get all\/some &#8220;rows&#8221; of your tabular data (docs with the same schema) with one request as you know it from SQL.<\/p>\n<p>To write such views easily the property <code>type<\/code> is very common for CouchDB docs. Your known name from a SQL table can be your type like <code>doc.type: \"animal\"<\/code><\/p>\n<p>Your view names will be maybe <code>animalByName<\/code> or <code>animalByWeight<\/code>. Depends on your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>llabball &#8230; does it mean that i need to create multiple databases? No. &#8230; a document mean a row in sql or am i misunderstood? That&#8217;s right. The SQL table defines column header (name and type) &#8211; that are the JSON property names of the doc. So, all docs (rows) with the same properties (a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8110","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8110"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8110\/revisions"}],"predecessor-version":[{"id":8613,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8110\/revisions\/8613"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}