PouchDB Read/Retrieve DocumentThe db.get() method is used to read or retrieve the document created in a database. This method also accepts the document id and optional callback function. Syntax: PouchDB Read Document ExampleSave the above code in a file named "Read_Document.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node: It will read the document stored in "Second_Database" on PouchDB Server. Read a Document from Remote DatabaseYou can read or retrieve a document from a remote database (CouchDB). For this, you have to pass the path of the database in CouchDB, which contains the document that you want to read instead of the database name. ExampleThere is a database named "employees" in the CouchDB Server. By clicking on "employees", you can see a document: Let's fetch data of that document: Save the above code in a file named "Read_Remote_Document.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node: It will read the document stored in "employee" database on CouchDB Server. Output: { _id: '001', _rev: '3-276c137672ad71f53b681feda67e65b1', name: 'Ajeet', age: 28, designation: 'Developer' } Next TopicPouchDB Update Document |