Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b222f09

Browse files
committed
Update listDatabases
1 parent 4a8664f commit b222f09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎connection.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async function main(){
66
* See https://docs.mongodb.com/ecosystem/drivers/node/ for more details
77
*/
88
const uri = "mongodb+srv://<username>:<password>@<your-cluster-url>/test?retryWrites=true&w=majority";
9-
9+
1010
/**
1111
* The Mongo Client you will use to interact with your database
1212
* See https://mongodb.github.io/node-mongodb-native/3.3/api/MongoClient.html for more details
@@ -32,10 +32,10 @@ main().catch(console.err);
3232

3333
/**
3434
* Print the names of all available databases
35-
* @param {MongoClient} client A MongoClient that is connected to a cluster with the sample_airbnb database
35+
* @param {MongoClient} client A MongoClient that is connected to a cluster
3636
*/
3737
async function listDatabases(client){
38-
databases = await client.db("sample_airbnb").admin().listDatabases();
38+
databases = await client.db().admin().listDatabases();
3939

4040
console.log("Databases:");
4141
databases.databases.forEach(db => console.log(` - ${db.name}`));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /