Skip to content

Instantly share code, notes, and snippets.

@Hfreitas
Last active September 18, 2020 03:37
Show Gist options
  • Save Hfreitas/be7a771c1e118e31ecdb4dacbacadd17 to your computer and use it in GitHub Desktop.
Save Hfreitas/be7a771c1e118e31ecdb4dacbacadd17 to your computer and use it in GitHub Desktop.
const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://masterUser:<password>@myfirstdb.7vxnx.gcp.mongodb.net/<dbname>?retryWrites=true&w=majority";
const client = new MongoClient(uri, { useNewUrlParser: true });
client.connect(err => {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment