update: add ci cd files ==> do not edit those files
This commit is contained in:
+28
-26
@@ -1,26 +1,29 @@
|
||||
const mongoose = require('mongoose')
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
mongoose.plugin(schema => {
|
||||
schema.set('toObject', {
|
||||
getters: true
|
||||
})
|
||||
schema.set('toJSON', {
|
||||
getters: true
|
||||
})
|
||||
schema.set('timestamps', {
|
||||
createdAt: 'created_at',
|
||||
updatedAt: 'updated_at'
|
||||
})
|
||||
})
|
||||
mongoose.plugin((schema) => {
|
||||
schema.set("toObject", {
|
||||
getters: true,
|
||||
});
|
||||
schema.set("toJSON", {
|
||||
getters: true,
|
||||
});
|
||||
schema.set("timestamps", {
|
||||
createdAt: "created_at",
|
||||
updatedAt: "updated_at",
|
||||
});
|
||||
});
|
||||
|
||||
// mongodb database connection string. change it as per your needs. here "mydb" is the name of the database. You don't need to create DB from mongodb terminal. mongoose create the database automatically.
|
||||
// mongoose.connect('mongodb://localhost:27017/bargrest_barg', {
|
||||
mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:27017/bargrest_bargtest', {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false,
|
||||
useCreateIndex: true
|
||||
})
|
||||
mongoose.connect(
|
||||
"mongodb://root:asrerb6udsf13sdfb6@srv-captain--danak-mongo-2:27017/bargrest_bargtest?authSource=admin",
|
||||
{
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false,
|
||||
useCreateIndex: true,
|
||||
}
|
||||
);
|
||||
//
|
||||
// mongoose.connect('mongodb://bargrest_admin:barg1234@localhost:27017/bargrest_barg', {
|
||||
// useNewUrlParser: true,
|
||||
@@ -29,7 +32,6 @@ mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:2701
|
||||
// useCreateIndex: true
|
||||
// })
|
||||
|
||||
|
||||
/*mongoose.connect('mongodb://barg_database:D7pAAqDWxx4ZpgnC@cluster0-shard-00-00.dle1t.mongodb.net:27017,cluster0-shard-00-01.dle1t.mongodb.net:27017,cluster0-shard-00-02.dle1t.mongodb.net:27017/barg?ssl=true&replicaSet=atlas-zj3m2c-shard-0&authSource=admin&retryWrites=true&w=majority', {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
@@ -43,10 +45,10 @@ mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:2701
|
||||
// useCreateIndex: true
|
||||
// })
|
||||
|
||||
const database = mongoose.connection
|
||||
database.on('error', console.error.bind(console, 'connection error:'))
|
||||
database.once('open', function callback() {
|
||||
console.log("MongoDB Connected...")
|
||||
})
|
||||
const database = mongoose.connection;
|
||||
database.on("error", console.error.bind(console, "connection error:"));
|
||||
database.once("open", function callback() {
|
||||
console.log("MongoDB Connected...");
|
||||
});
|
||||
|
||||
module.exports = database
|
||||
module.exports = database;
|
||||
|
||||
Reference in New Issue
Block a user