Created
June 29, 2022 12:29
-
-
Save AlexJuarez/9620b9eaf8f0ea8f99cb1ac3701ba76a to your computer and use it in GitHub Desktop.
a example query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MongoDB Playground | |
// To disable this template go to Settings | MongoDB | Use Default Template For Playground. | |
// Make sure you are connected to enable completions and to be able to run a playground. | |
// Use Ctrl+Space inside a snippet or a string literal to trigger completions | |
// Select the database to use. | |
const { MongoClient } = require("mongodb"); | |
const uri = 'mongodb+srv://regen:Ba6qFCPCctcvW8DHavCu@regen-staging.fmfup.mongodb.net/admin'; | |
const client = new MongoClient(uri); | |
const run = () => { | |
return async function run() { | |
try { | |
await client.connnect(); | |
const db = client.db('regen-staging'); | |
const result = await db.command({ | |
blogPosts: 1, | |
}); | |
console.log(result); | |
} finally { | |
client.close(); | |
} | |
} | |
} | |
run(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment