2015-08-13

MongoDB - How to list all collections

db.getCollectionNames();

// This gets only the first found collection
db.getCollectionNames()[1];

// This ignores the system collection called "system.indexes"
db.getCollectionNames().filter(function(x){return x!=='system.indexes'});

No comments:

Post a Comment