colabfit / colabfit-tools

Tools for constructing and manipulating datasets for fitting interatomic potentials
Other
6 stars 2 forks source link

Read only MongoDatabase mode? #6

Open ipcamit opened 2 years ago

ipcamit commented 2 years ago

How feasible would be to have a MongoDatabase client which does not write to database at all. For lot of applications, dataset would be created and curated once but read several times. It would be nice and more robust to have MongoDatabase(read_only=True) mode where it has two properties:

  1. During instantiation it checks if the database exists, else raises an exception if it does not.
  2. Any of the insert data methods do not write to the database but rather raise an exception of client being in read only mode

Added bonus: it can be used as archival method where once committed to some repository, clients can only have read-only access to maintain integrity. For that dataset would need additional property which can be manually toggle to enable write access or read access.

Quick google search reveal mongo does have read only user access. But I do not think that feature is as usefule.