I have a pouch database that contains hundreds documents of 1 Mo, so the total size is ~100 Mo. It's an Android Cordova app and I'm using:
- PouchDb 5.4.5
- cordova-plugin-sqlite-2 1.0.4
Each document is like this:
{
data: '...', // Very long string of 1 Mo
filename: 'myFile', // Name of a file
index: 34 // An integer
}
I'd like to do a query on this db to list all documents indexed by filename and index, without retrieving data
property which is heavy.
So I did a view like this:
var designDoc = {
_id: '_design/getByFilenameAndIndex',
views: {}
};
mapFunction = function(doc){
emit(doc.filename + '/' + doc.index);
}
designDoc.views['getByFilenameAndIndex'] = { map: mapFunction.toString() };
myDb.put(designDoc);
But when I try to query my db, like this:
myDb.query('getByFilenameAndIndex', {include_docs: false}).then(function(docsByFilenameAndIndex){
console.log(docsByFilenameAndIndex);
});
I get the following error:
Why I'm having this error ? I still have 900 Mo of ram available on my device (Android 6), and I'm not even including docs. If my db is less than 20 Mo it works fine.
It was working fine too with db of 40 Mo before using SQLite plugin, but I can't work without it since I need more than 50 Mo database.
Edit: I tried to do this and I get the error too: myDb.allDocs({include_docs: false});