Mongo Preventing access to dangerous command

46 Views Asked by At

Reading Mongo: Definite guide:

In first chapter, author mentions the following snippet to change some of the default commands of db:

var no = function() {
   print("Not on my watch.");
};

// Prevent dropping databases
db.dropDatabase = DB.prototype.dropDatabase = no;

// Prevent dropping collections
DBCollection.prototype.drop = no;

// Prevent dropping an index
DBCollection.prototype.dropIndex = no;

// Prevent dropping indexes
DBCollection.prototype.dropIndexes = no;

I know db is pointing to current database, but my question is from where does DB is coming from?

0

There are 0 best solutions below