Is creating multiple PouchDB databases on the same application considered bad design?

后端 未结 1 838
耶瑟儿~
耶瑟儿~ 2021-02-19 06:18

I come from a Mysql background and I\'m using Pouchdb now. I\'m used to the SQL pattern of having 1 database and many tables per app.

In pouchDB it\'s different, because

1条回答
  •  花落未央
    2021-02-19 07:01

    Is creating multiple PouchDB databases on the same application considered bad design?

    In a word: No.

    Long answer: Databases in CouchDB/PouchDB are essentially free. And some application designs require multiple databases.

    Consider a theoretical Offline-first/mobile app which tracks an agent's sales. It may have a database for inventory management purposes, which is synchronized with a central CouchDB server.

    It will likely also have a per-agent database, with client and sales info for a given agent.

    The PouchDB app will need both databases. And due to the design of CouchDB, there's no (easy, sane) way to keep those data sets in the same database, and keep agent's records separate from each other.

    Databases in CouchDB/PouchDB are more like tables than databases in an RDBMS.

    The only real limiting factor for creating additional databases in PouchDB (which doesn't apply to CouchDB), is that there's no easy way to list your existing databases, except with the use of plugin. This needn't be a real limitation--it just means you need to remember which databases you've created (you probably shouldn't be programatically creating randomly-named databases... but that would probably be a bad design anyway. ;-) )

    0 讨论(0)
提交回复
热议问题