← Back to IndexedDB domain

IndexedDB.getMetadata

Gets metadata of an object store.

Domain: IndexedDB experimental

Parameters

NameTypeDescription
securityOrigin (optional)stringAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin.
storageKey (optional)stringStorage key.
storageBucket (optional)Storage.StorageBucketStorage bucket. If not specified, it uses the default bucket.
databaseNamestringDatabase name.
objectStoreNamestringObject store name.

Returns

NameTypeDescription
entriesCountnumberthe entries count
keyGeneratorValuenumberthe current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.

Example Request

{
  "id": 1,
  "method": "IndexedDB.getMetadata",
  "params": {
    "databaseName": "databaseName-value",
    "objectStoreName": "objectStoreName-value"
  }
}

Example Response

{
  "id": 1,
  "result": {
    "entriesCount": 1.0,
    "keyGeneratorValue": 1.0
  }
}

Usage in Node.js

const result = await send('IndexedDB.getMetadata', {"databaseName": "databaseName-value", "objectStoreName": "objectStoreName-value"});
console.log(result);
// {"entriesCount": 1.0, "keyGeneratorValue": 1.0}