fix
This commit is contained in:
+9
-8
@@ -1,14 +1,7 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
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'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 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.
|
||||
const inHostUrl = 'mongodb://asanserv_admin:admin1234@localhost:27017/asanserv_database'
|
||||
@@ -22,6 +15,14 @@ mongoose.connect(outHostUrl, {
|
||||
useCreateIndex: true
|
||||
})
|
||||
|
||||
mongoose.plugin(schema => {
|
||||
schema.set('toObject', { getters: true })
|
||||
schema.set('toJSON', { getters: true })
|
||||
schema.set('timestamps', {
|
||||
createdAt: 'created_at',
|
||||
updatedAt: 'updated_at'
|
||||
})
|
||||
})
|
||||
const database = mongoose.connection
|
||||
database.on('error', console.error.bind(console, 'connection error:'))
|
||||
database.once('open', function callback() {
|
||||
|
||||
Reference in New Issue
Block a user