node.js - error[Error (E_UNKNOWN) Encountered an unexpected error] Details: MongoError: topology was destroyed -


this sample code creating zip file.

examplefunction: function(req, res, next){      test.create({....       }).exec(function (error, hobj){         if(error) {console.log('error'+ error); return next(error)};         if(!hobj) {console.log('error'); return res.send({error : "error"});}             var generateduuid=uuid.v4().replace(/[^a-za-z0-9]/g,'_');             var output = fs.createwritestream(path.join(__dirname,'../../assets/images/'+generateduuid+'.zip'));             ziparchive.pipe(output);              ziparchive.bulk([{ expand: true, cwd: path.join(__dirname,'../../assets/images/'), src: ['abc.mp3','xyz.mp3'], dest: 'newdir'}]);             ziparchive.finalize();             return res.send({zipname : generateduuid+'.zip'});     }); } 

calling method in sailsjs controller continuously, cause mongo error[error[error (e_unknown) encountered unexpected error] details: mongoerror: topology destroyed].

error: sending 500 ("server error") response:   error (e_unknown) :: encountered unexpected error mongoerror: topology destroyed     @ server.insert (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:920:49)     @ server.insert (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/server.js:324:17)     @ executecommands (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/bulk/ordered.js:450:23)     @ orderedbulkoperation.execute (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/bulk/ordered.js:503:10)     @ bulkwrite (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/collection.js:569:8)     @ collection.insertmany (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/collection.js:471:44)     @ collection.insert (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/node_modules/mongodb/lib/collection.js:722:15)     @ collection.insert (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/lib/collection.js:177:48)     @ object.module.exports.adapter.create (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails-mongo/lib/adapter.js:282:18)     @ module.exports.create (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:84:13)     @ bound.createvalues (/var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:214:16)     @ /var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:74:20     @ /var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:708:13     @ /var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16     @ /var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:263:32     @ /var/www/html/projects/rishi/final/rishi-music_server/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16  details:  mongoerror: topology destroyed 

what problem. me.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -