PouchDB Update BatchThe bulkDocs() method is used to update an array of documents in PouchDB. To update a batch, you have to create an array of documents where, each document contains _id, _rev and the values that you want to update. We have a database named "Second_Database" stored in PouchDB and contains 3 documents: Let's update the documents using their respective _id and _rev values: Change the name and age of all three documents: Save the above code in a file named "Update_Batch2.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node: Output: VerificationYou can verify that the batch is updated by using node (Read_Batch) command: Update Batch in Remote DatabaseWe can also update an array of documents in a database that is stored remotely on a server (CouchDB). You just have to pass the path to the database in CouchDB, which contains the document that you want to update. ExampleWe have a database named "employees" in the CouchDB Server. There are three documents in "employees" database You can fetch these documents by using node (Read_Remote_Batch.js) command. Now update all the documents name and age of "employees" database stored on CouchDB Server. Save the above code in a file named "Update_Remote_Batch.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node: It will update the documents in "employees" database. VerificationYou can verify that the batch is updated by using node (Read_Remote_Batch) command: Next TopicPouchDB Delete Batch |