Last active
May 25, 2019 15:37
-
-
Save hscheuerle/0692b0636165a37cba5dff32f3bb3b17 to your computer and use it in GitHub Desktop.
Naming for mongodb driver
This file contains hidden or 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
const { MongoClient: driver } = require('mongodb'); | |
const connectionSpread = [ | |
process.env.DB_URL_DEVELOPMENT || 'mongodb://localhost:27017', | |
{ useNewUrlParser: true } | |
]; | |
(async () => { | |
try { | |
const client = await driver.connect(...connectionSpread); | |
const mongo = client.db('test').collection('some-objects'); | |
const { result } = await mongo.insertOne({ test: "test" }); | |
} catch (reason) { | |
console.log(reason); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment