Skip to content

How to check the existence of DB and Collection #2

@sarankup

Description

@sarankup

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');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions