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.
19 lines
406 B
19 lines
406 B
const Mongoose = require("mongoose");
|
|
|
|
module.exports = context => {
|
|
const mongoose = new Mongoose.Mongoose();
|
|
mongoose.connect(
|
|
context.connectionString,
|
|
{ useNewUrlParser: true }
|
|
);
|
|
const db = context.collections.reduce((dbObj, coll) => {
|
|
dbObj[coll] = mongoose.model(coll,
|
|
new mongoose.Schema({}, { strict: false }));
|
|
return dbObj;
|
|
}, {});
|
|
|
|
db.__mongoose__ = mongoose;
|
|
|
|
return db;
|
|
|
|
};
|
|
|