Skip to content

Instantly share code, notes, and snippets.

@AlexJuarez
Created June 29, 2022 12:29
Show Gist options
  • Save AlexJuarez/9620b9eaf8f0ea8f99cb1ac3701ba76a to your computer and use it in GitHub Desktop.
Save AlexJuarez/9620b9eaf8f0ea8f99cb1ac3701ba76a to your computer and use it in GitHub Desktop.
a example query
// 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