showing results for - "show all collections in mongodb node js"
Luisa
03 Oct 2016
1var mongo = require('mongodb').MongoClient;
2
3async function connect(){
4    /**
5     * Connection URI. Update <username>, <password>, and <your-cluster-url> to reflect your cluster.
6     * See https://docs.mongodb.com/ecosystem/drivers/node/ for more details
7     */
8    const uri = "yourUri";
9 
10
11    const client = new mongo(uri);
12 
13    try {
14        // Connect to the MongoDB cluster
15        await client.connect();
16        
17        // Make the appropriate DB calls
18        const db = client.db("testDatabase");
19       
20        const collections = await db.collections();
21        collections.forEach (c=>console.log(c.collectionName));
22        
23 
24       
25       
26 
27    } catch (e) {
28        console.error(e);
29    } finally {
30        await client.close();
31    }
32}
33
34connect().catch(console.error);
35
Lennart
05 Jan 2019
1async function connect(){
2    /**
3     * Connection URI. Update <username>, <password>, and <your-cluster-url> to reflect your cluster.
4     * See https://docs.mongodb.com/ecosystem/drivers/node/ for more details
5     */
6    const uri = "yourUri";
7 
8
9    const client = new mongo(uri);
10 
11    try {
12        // Connect to the MongoDB cluster
13        await client.connect();
14        
15        // Make the appropriate DB calls
16        const db = client.db("testDatabase");
17       
18        const collections = await db.collections();
19        collections.forEach (c=>console.log(c.collectionName));
20
21        }
22        
23        
24 
25        // Make the appropriate DB calls
26       
27 
28    } catch (e) {
29        console.error(e);
30    } finally {
31        await client.close();
32    }
33}
34
35connect().catch(console.error);
36
queries leading to this page
mongodb node js get all documents in collectionmongodb see all collections node jshow to list all collections from a database in mongodb node jsmongodb show all collectionsmongodb show collections node jsprint collections in database mongodb in node jshow to get list from mongodb databasehow to get all documents in a collection mongodb in node jsshow all collections in mongohow to get all collections in mongodb node jsshow collections mongodb nodejscollections mongodb find all nodejsmongodb get all documents in collection nodejsnode get all object in a collection mongodbmongodb node js get all collectionsget all documents in collection mongodb node jshow to show all collections in mongodb atlas in nodelist collections in mongodb nodelist all databases in nodejs mongodbhow to get all collections in mongodb node jslist all collections in mongodb node jshow to get all collections name in mongodb node jsnodejs mongodb list all documentshow to list all database in mangodbshow all documents in a collection mongodb node jshow to get all collection names in mongodb node driverfind all collections of mongo db nodelist collections in mongodb nodejsdb list collectionsget list node js mongodbnode js mongodb list collectionsshow collections mongodb node jsshow all collections in mongodbshow all records in collection mongodbdb list mongodbmongodb find all list collection data nodejsget all collection on mongodb nodejsmongodb show all collections in a dbhow to get all collections in mongodb nodeshow all collections in mongodb node jsget all available collections in mongodb nodemongodb node js list collectiond atamongodb list all collections in all databasenodejs see mongodb database collectionmongodb collection find all node jsmongodb client read all collections nodejshow to see collections in mongodb shellget all obj in mongodb jsnode list db in the mongodbquery all collections mongodb nodejshow to see all collections in mongodb with mongoshget all collections in mongodb node jsshow all collections in mongodb node js