fix
This commit is contained in:
@ -39,12 +39,12 @@ export default class MqttMongo extends Events.EventEmitter {
|
||||
|
||||
connectToDatabase() {
|
||||
this.loginfo("About to connect to database")
|
||||
Mongo.MongoClient.connect(this.options.database)
|
||||
Mongo.MongoClient.connect(this.options.mongodbUrl)
|
||||
.then(
|
||||
(tmpDbHandle: Mongo.Db) => {
|
||||
this.dbHandle = tmpDbHandle
|
||||
this.dbReady = true;
|
||||
this.loginfo("Database connected")
|
||||
this.loginfo(`Database ${this.options.mongodbUrl} connected`)
|
||||
this.dbHandle.on('reconnectFailed', (err : any) => { this.logwarn(`Error on database ${err}`) })
|
||||
this.dbHandle.on('reconnect', () => {
|
||||
this.loginfo("Reconnect on database")
|
||||
@ -77,7 +77,7 @@ connectToDatabase() {
|
||||
.then(
|
||||
(r) => {
|
||||
if (this.options.verbose) {
|
||||
this.loginfo(`Successfully inserted into database ${JSON.stringify(msg.getMessage())}`)
|
||||
this.loginfo(`Successfully inserted into database ${this.options.mongodbUrl}, ${this.options.collection}: ${JSON.stringify(msg.getMessage())}`)
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
|
Reference in New Issue
Block a user