I wrote a script that results in billions of documents inserted into a MongoDB collection. Not optimum, I know. When I tried to run it locally, it resulted in "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory".
Instead of running it on a localhost, I want to throw the .js file on a web server and run the file there.
Do I make changes to this code? Or upload file via FTP?
function mongoIfy(solution_JSONs){
// retrieve
var MongoClient = require('mongodb').MongoClient;
// Connect to the db
MongoClient.connect("mongodb://localhost:27017/slither_puzzle", function(err, db) {
if(err) { return console.dir(err); }
if(!err) {
console.log("We are connected");
var collection = db.collection('solutions');
collection.insert(solution_JSONs)
}
});
}
Thanks in advance!