0

I am using couchapp with CouchDB to store information about connections between nodes. I am trying to save an array of json data. If the number of items in the array is less than 2000, everything works fine. Unfortunately, bigger amounts of data cause errors:

POST http://localhost:5984/graph_project/  jquery.js:8240
send jquery.js:8240
jQuery.extend.ajax jquery.js:7719
saveDoc jquery.couch.js:627
writeJSONtoDb main.js:185
CSVArrayToJson main.js:335
(anonymous function)

Uncaught TypeError: Cannot read property 'error' of null jquery.couch.js:649
$.ajax.complete jquery.couch.js:649
fire jquery.js:1075
self.fireWith jquery.js:1193
done jquery.js:7553
callback

and only part of the data is saved correctly.

The code looks like this:

function writeJSONtoDb(dataToSave) {
  db = $.couch.db(DATABASE_NAME); 
  for(var i in dataToSave){
    db.saveDoc(dataToSave[i], {     
        success: function(data) {
            console.log("node added succesfully");
        },
        error: function(data){
            console.log("Problem with data" + data);
        }
    });
  }      
}

Where is the problem? Does CouchDB contain any buffer which may be overfilled?

4

0 回答 0