How to know if a database is open or closed

I am running into the issue of database not open but before i address that, i was wondering if there is a way to determine the state of a database. I can see .close() method on Database but not much else on it’s current state.

Database.getPath will return null if the DB is closed or deleted and and absolute path, otherwise. Similarly Database.count will return 0 if the database is closed and the number of documents (which might be 0), otherwise.

1 Like