feature/worker #111
@@ -2,7 +2,3 @@ import 'dotenv/config';
|
||||
|
||||
// Connection URL
|
||||
export const mongoUrl = process.env.MONGO_ADDR
|
||||
|
||||
console.log('=======================================================')
|
||||
console.log('mongoUrl', mongoUrl)
|
||||
console.log('=======================================================')
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
const MDBClient = require('mongodb').MongoClient
|
||||
import { MongoClient as MDBClient } from 'mongodb'
|
||||
|
||||
const { mongoUrl } = require('./const')
|
||||
import { mongoUrl } from './const'
|
||||
|
||||
const dbInstanses = {
|
||||
}
|
||||
|
||||
console.log('=======================================================')
|
||||
console.log('mongoUrl', mongoUrl)
|
||||
console.log('=======================================================')
|
||||
|
||||
|
||||
const mongoDBConnect = async () => {
|
||||
try {
|
||||
const MongoClient = new MDBClient(mongoUrl, {
|
||||
useUnifiedTopology: true,
|
||||
})
|
||||
const MongoClient = new MDBClient(mongoUrl, {})
|
||||
const client = await MongoClient.connect()
|
||||
console.log('Подключение к MongoDB успешно')
|
||||
return client
|
||||
|
||||
@@ -2,6 +2,11 @@ import mongoose from 'mongoose'
|
||||
|
||||
import { mongoUrl } from './const'
|
||||
|
||||
console.log('=======================================================')
|
||||
console.log('mongoUrl2', mongoUrl)
|
||||
console.log('=======================================================')
|
||||
|
||||
|
||||
mongoose.connect(`${mongoUrl}`).then(() => {
|
||||
console.log('Подключение к MongoDB успешно')
|
||||
}).catch((err) => {
|
||||
|
||||
Reference in New Issue
Block a user