mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
425 B
22 lines
425 B
'use strict';
|
|
|
|
const { MongoClient, ObjectId, Int32 } = require('mongodb')
|
|
, configs = require(__dirname+'/../configs/main.js');
|
|
|
|
module.exports = {
|
|
|
|
connect: async () => {
|
|
if (module.exports.client) {
|
|
throw new Error('Mongo already connected');
|
|
}
|
|
module.exports.client = await MongoClient.connect(configs.dbURL, {
|
|
useNewUrlParser: true,
|
|
useUnifiedTopology: true
|
|
});
|
|
},
|
|
|
|
ObjectId,
|
|
|
|
NumberInt: Int32,
|
|
|
|
}
|
|
|