PouchDB Create Database

We can create a database in PouchDB by using PouchDB constructor in Node.js command prompt. You have to pass the name of the database as a parameter.

Syntax:


Create Database Example

First open Node.js command prompt. Now you need to require the PouchDB package using the require() method and then you can create a database.

See this example:

Save the above code in a file named "Create_Database.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node:

PouchDB Create database 1

You can see "Database created successfully" message on your console. You can see the locally created Database folder in your current directory.

PouchDB Create database 2



Latest Courses