In this part, we will talk about the ideas like, compaction and recovery of mass information from PouchDB.
Compaction
You can lessen the size of an information base by eliminating the unused information utilizing reduced() technique. You can minimized a nearby data set just as far off information base utilizing this technique.
Following is a model exhibiting the use of the smaller() strategy in PouchDB.
//Requiring the package
var PouchDB = require('PouchDB');
//Creating the database object
var db = new PouchDB('sample_database');
db.compact(function (err, result) {
if (err) {
return console.log(err);
} else {
console.log(result);
}
});
BulkGet Method
You can recover a bunch of reports in mass utilizing the bulkGet() strategy. To this technique, you need to pass a bunch of id's and _rev's.
Following is a model exhibiting the utilization of the bulkGet() technique in PouchDB.
//Requiring the package
var PouchDB = require('PouchDB');
//Creating the database object
var db = new PouchDB('my_database');
//Preparing documents
//Inserting Document
db.bulkGet({docs: [
{ id: "001", rev: "1-5dc593eda0e215c806677df1d12d5c47"},
{ id: "002", rev: "1-2bfad8a9e66d2679b99c0cab24bd9cc8"},
{ id: "003", rev: "1-7cff4a5da1f97b077a909ff67bd5b047"} ]}, function(err, result) {
if (err) {
return console.log(err);
} else {
console.log(result);
}
});
