June 2014
Intermediate to advanced
696 pages
38h 52m
English
There are two ways to delete collections. The first is to call dropCollection(name) on the Db object. The second is to call the drop() method on the Collection object; this is sometimes more convenient, such as when you are iterating through a list of Collection objects.
The following are the two methods:
var myDB = db.db("myDB ");myDB.dropCollection("collectionA", function(err, results){ });// ormyDB.collection("collectionB", function(err, collB){ collB.drop();});
Read now
Unlock full access