Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check the existence of DB and Collection #2

Open
sarankup opened this issue Jul 22, 2018 · 0 comments
Open

How to check the existence of DB and Collection #2

sarankup opened this issue Jul 22, 2018 · 0 comments

Comments

@sarankup
Copy link

Hi,

I want to check whether DB and Collection already exists before I create them. Please advise how to achieve.

I want to check whether DB exists before I create it

const localStorageObj = new StorageDB({
    storage: window.localStorage,     // storage object, default is window.localStorage. If you want to store data in memory only, you can set it null
    database: localStorage.getItem('appkey'),               // database name, default is 'db'
    primaryKey: 'id'                  // primary key of collection, default is '_id'
});

I want to check whether the collection is exists before create it
const UsercommentsTable = localStorageObj.get('UsercommentsTable');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant