-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdmlab.js
22 lines (18 loc) · 902 Bytes
/
bdmlab.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// const MongoClient = require('mongodb').MongoClient;
// const uri = "mongodb+srv://jmp0284:mDb*2019@cluster0-dsoob.mongodb.net/test?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();
// });
const mongoose = require('mongoose');
const uri = 'mongodb+srv://jmp0284:mDb*2019@cluster0-dsoob.mongodb.net/jmpmevn?retryWrites=true&w=majority';
const options = {useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true};
// Or using promises
mongoose.connect(uri, options).then(
/** ready to use. The `mongoose.connect()` promise resolves to mongoose instance. */
() => { console.log('Conectado a DB') },
/** handle initial connection error */
err => { console.log(err) }
);