MongoDB Periksa apakah ada koleksi

db.collectionNames(collName, function(err, names) {
    console.log('Exists: ', names.length > 0);
});

// MongoDB 2.x:
db.listCollections({name: collName})
    .next(function(err, collinfo) {
        if (collinfo) {
            // The collection exists
        }
    });
VasteMonde