PouchDB Tutorial
PouchDB Useful Resources
Selected Reading
- PouchDB - Miscellaneous
- PouchDB - Synchronization
- PouchDB - Replication
- PouchDB - Deleting Attachment
- PouchDB - Retrieving Attachment
- PouchDB - Adding Attachment
- PouchDB - Delete Batch
- PouchDB - Update Batch
- PouchDB - Fetch Batch
- PouchDB - Create Batch
- PouchDB - Delete Document
- PouchDB - Update Document
- PouchDB - Read Document
- PouchDB - Create Document
- PouchDB - Delete Database
- PouchDB - Database Info
- PouchDB - Create Database
- PouchDB - Environment
- PouchDB - Overview
- PouchDB - Home
PouchDB Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PouchDB - Create Database
PouchDB - Create Database
You can create a database in PouchDB using the PouchDB constructor.
Syntax
Following is the syntax of using the PouchDB constructor. To this, you need to pass the name of the database as a parameter.
new PouchDB(Database_name)
Example
To create a database in PouchDB using node, first of all, you need to require the PouchDB package using the require() method and then you can create a database as shown in the following example.
//Requiring the package var PouchDB = require( PouchDB ); //Creating the database object var db = new PouchDB( my_database ); console.log ("Database created Successfully.");
Save the above code in a file with the name Create_Database.js. Open the command prompt and execute the JavaScript file using node as shown below.
C:PouchDB_Examples>node Create_Database.js
This will create a database locally (you can see the folder in the current directory) displaying the following message.
Database created Successfully.Advertisements