CouchDB: "Database for the user" or "One database for all"?

I am creating a simple bookmarking application in which users will have extensions installed in their browsers that synchronize local bookmarks in our application.

I use CouchDB to store user data. If scalability is what I'm aiming for, then what is the best way to use CouchDB with the following options?

  • Have one couchDB and put everything in it.
  • Create a dedicated database for the user and save the bookmarks as a document.

Anything else?

+6
source share
1 answer

A special database for each user is more important if you do not want other users to be able to read the contents of another user database. This is because CouchDB cannot apply read permissions for each document, only for each database. The problem with creating many databases is that you cannot create views spanning databases, views can only work with documents in one database.

General rule of thumb : if privacy issues in user data are not so important, use one big database.

Note. This applies only to CouchDB. You can get around this restriction of rights if you have another layer of software in front of CouchDB, such as a proxy or web authentication framework.

+13
source

Source: https://habr.com/ru/post/897476/


All Articles