Creating a database within mongodb and it throws topology error.
topology destroyed
Attached screenshot
Topology was destroyed
error comes, when mongodb was writing something and connection was closed/interrupted in middle.
Have a look at the code which throws this error :
Mongos.prototype.insert = function(ns, ops, options, callback) {
if(typeof options == 'function') callback = options, options = {}, options = options || {};
if(this.state == DESTROYED) return callback(new MongoError(f('topology was destroyed')));
// Not connected but we have a disconnecthandler
if(!this.isConnected() && this.s.disconnectHandler != null) {
return this.s.disconnectHandler.add('insert', ns, ops, options, callback);
}
// No mongos proxy available
if(!this.isConnected()) {
return callback(new MongoError('no mongos proxy available'));
}
// Execute write operation
executeWriteOperation(this, 'insert', ns, ops, options, callback);
}
Solution :
Kindly restart your mongodb and MongoDB compass as well, just to be on the safer side, and you should be able to create collections without any error.