---
title: "IDBFactory | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface IDBFactory

The **`IDBFactory`** interface of the IndexedDB API lets applications asynchronously access the indexed databases. The object that implements the interface is window.indexedDB. You open — that is, create and access — and delete a database with this object, and not directly with IDBFactory.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory)

interface IDBFactory {  
    [cmp](#cmp-1)(first: any, second: any): number;  
    [databases](#databases-1)(): Promise<[IDBDatabaseInfo](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBDatabaseInfo/)\[\]\>;  
    [deleteDatabase](#deletedatabase-1)(name: string): [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/);  
    [open](#open-1)(name: string, version?: number): [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/);  
}

##### Index

### Methods[](#methods)

[cmp](#cmp) [databases](#databases) [deleteDatabase](#deletedatabase) [open](#open)

## Methods[](#methods-1)

### cmp[](#cmp)

-   cmp(first: any, second: any): number[](#cmp-1)
    
    The **`cmp()`** method of the IDBFactory interface compares two values as keys to determine equality and ordering for IndexedDB operations, such as storing and iterating.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/cmp)
    
    #### Parameters
    
    -   first: any
    -   second: any
    
    #### Returns number
    

### databases[](#databases)

-   databases(): Promise<[IDBDatabaseInfo](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBDatabaseInfo/)\[\]\>[](#databases-1)
    
    The **`databases`** method of the IDBFactory interface returns a Promise that fulfills with an array of objects containing the name and version of all the available databases.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases)
    
    #### Returns Promise<[IDBDatabaseInfo](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBDatabaseInfo/)\[\]\>
    

### deleteDatabase[](#deletedatabase)

-   deleteDatabase(name: string): [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/)[](#deletedatabase-1)
    
    The **`deleteDatabase()`** method of the IDBFactory interface requests the deletion of a database. The method returns an IDBOpenDBRequest object immediately, and performs the deletion operation asynchronously.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase)
    
    #### Parameters
    
    -   name: string
    
    #### Returns [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/)
    

### open[](#open)

-   open(name: string, version?: number): [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/)[](#open-1)
    
    The **`open()`** method of the IDBFactory interface requests opening a connection to a database.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/IDBFactory/open)
    
    #### Parameters
    
    -   name: string
    -   `Optional`version: number
    
    #### Returns [IDBOpenDBRequest](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.IDBOpenDBRequest/)
