Database Methods: Drop All

Deleting all databases.

🪶 This method removes
  • all existing databases in MerlinDB.

    Use this method with caution as it removes all databases in IndexedDB.
    The .dropAll() method has only one argument that must be passed as a Array, this argument must contain the names of the databases that you do not want to delete.
    1
  • import
  • MerlinDB
  • from
  • "@chrisaxxwell/merlin-db";
    2
  • //Or if you are using 'merlindb.min.js' just call 'new MerlinDB()';
  • 3
    4
  • const
  • merlin =
  • new
  • MerlinDB(
  • )
  • ;  
    5merlin
  • .dropAll(
  • ['not-this-db1', 'not-this-db2']
  • )
  • ;
    6
    7
  • //e.g.
  • 8
  • //Suppose you have 3 databases db1, db2, db3
  • 9merlin
  • .dropAll(
  • [ 'db2' ]
  • )
  • .then(
  • e =>
  • {
  • 10   console
  • .log(
  • e
  • )
  • ;
    11  
  • //returns  { deleteDbCount: 2, "status": 200, "databasesDeleted": [ "db1", "db3' ... ]}
  • 12
  • }
  • )
  • ;