node.js - Writing the data in mongodb -
i inserting huge amount of data on mongodb using node.js. program working fine , can see in database path of mongo db data written files of databasename.0 128 kb, databasename.1 256 kb, databasename.0 512 kb,databasename.0 1024 kb, , last file of 2048 kb while inserting last file of 2048 kb connection lost mongodb , data not inserted. why happening how rid of please explain me concept. attach code using insert data. // connection.js used establish connection
var db = require('mongodb').db; var connection = require('mongodb').connection; var server = require('mongodb').server; var connectioninstance; module.exports = function(callback) { if (connectioninstance) { callback(connectioninstance); return; } var serveroptions = { 'auto_reconnect': true, 'poolsize': 100 }; var db = new db('test', new server('localhost', 27017, serveroptions)); db.open(function(err, databaseconnection) { if (err) console.log(err); connectioninstance = databaseconnection; console.log("connection established"); callback(databaseconnection); }); }; //the pgm insert data on mongodb using node.js var = 0; var mongoclient = require('mongodb').mongoclient; var mongoserver = require('mongodb').server; var serveroptions = { 'auto_reconnect': true, 'poolsize': 5 }; var = 0; var async = require('async'); var mongoclient = new mongoclient(new mongoserver('localhost', 27017, serveroptions)); var db = mongoclient.db('test'); var collection = db.collection('new_file_test'); var doc mongoclient.open(function(err, mongoclient) { if (err) { console.log(err) }; function save(callback) { console.log("am first"); doc = { 'trip_paramid': "111", 'tripid': '116', 'lattitude': '12.8929183', 'longitude': '77.63627', 'speed': '2', 'heading': '0', 'altitude': '80469', 'address': 'qwertyasdfgxcvbn', 'engine_status': 'normal', 'oil_pressure': '83.12', 'water_temp': '28', 'fuel_content': '0', 'brake': 'normal', 'creation_time': '2013-08-31 23:22:17', 'brakelight_status': 'normal', 'battery_status': '12.68', 'event_code': '8', 'dbinsert_time': '2013-08-31 23:24:59', 'gsm_status': '-51', 'cell_id': '45', 'vehicle_id': '123456', 'distance': '0' } callback(doc); } save(function(doc) { console.log("i got first"); console.log("inserting" + i); collection.insert(doc, function(err) { if (err) console.log('error occured'); else console.log("inserted" + i); }); }); });
the problem 32 bit mongodb using can store data of around 2gb. when replaced 64 bit works perfect.
Comments
Post a Comment