Mongo DB 显示除一个之外的所有集合

Mongo DB show all collections except one

in Mongo DB 我如何检索除 Test

以外的所有文档

我的代码显示了所有文档

db.getCollectionNames().forEach(function(collection) { 
    var result = db[collection]; 
    if(result != 'Test') { 
        print("All the documents: " + " for collection: "+ collection);
    } 
});

正确的是:

  db.getCollectionNames().forEach(function(collection){
     if(collection != 'Test') {
         print("All the documents: " + " for collection: "+ collection);
        }
       }
      );