Format stuff
This commit is contained in:
@@ -10,16 +10,17 @@ const connectDB = async () => {
|
|||||||
|
|
||||||
// Get and log all collections in the database
|
// Get and log all collections in the database
|
||||||
const collections = await conn.connection.db.collections();
|
const collections = await conn.connection.db.collections();
|
||||||
|
if (collections.length > 0) {
|
||||||
console.log("Collections:");
|
console.log("Collections:");
|
||||||
collections.forEach(collection => {
|
collections.forEach(collection => {
|
||||||
console.log(collection.collectionName);
|
console.log(collection.collectionName);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get and log the indexes of a specific collection (optional)
|
// Get and log the indexes of a specific collection (optional)
|
||||||
//const collectionName = "tombola"; // Replace with your collection name
|
const collectionName = "collectionname"; // Replace with your collection name
|
||||||
//const indexes = await conn.connection.db.collection(collectionName).indexes();
|
const indexes = await conn.connection.db.collection(collectionName).indexes();
|
||||||
//console.log(`Indexes in ${collectionName}:`);
|
console.log(`Indexes in ${collectionName}:`);
|
||||||
//console.log(indexes);
|
console.log(indexes);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Finish Database Stats.");
|
console.log("Finish Database Stats.");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user