-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for the latest MongoDB Driver #358
Conversation
works good, but please fix also this
|
I'm not good at Mongo yet, but I sort of fixed |
Ty, Also are haste entries auto removed after 30 days from latest visit from mongodb? |
Haven't tested yet, just recently installed 😏 |
Doesn't seem to work |
@JoCat Yes it does not work for me, I setuped expire in config.json file. Can someone fix the problem? |
@ririko5834 Honestly, I have no idea how it works |
@JoCat ConnectionName is not working correctly but I fixed it with this const MongoDocumentStore = function (options) {
this.expire = options.expire;
this.connectionName = process.env.DATABASE_NAME || options.connectionName;
this.connectionUrl = `${process.env.DATABASE_URL || options.connectionUrl}/${this.connectionName}`;
}; |
@ririko5834 did you insert it under storage inside the config file like this? "storage": {
"type": "mongo",
"connectionUrl": "mongodb+srv://username:password@cluster0.xxxx.mongodb.net",
"connectionName": "dbname",
"expire": 2592000
}, |
i am using the following config:
Everything works for me correctly |
@ririko5834 I am an idiot, I did not register expire in the config 🤣 |
Make sure to close the connection after reading/writing data in mongodb. It generates large amount of connections Then you cant view or make new pastes when you reach 500 connections limit: @JoCat Can you PR this? |
Yes, I can see in a couple of hours, I'll just be at home
|
@anondev-sudo i fixed the error with the connection limit, now the connection is closed after executing the request The only thing that I do not like this approach a little. Callback hell is crazy. I tried to rewrite the class here (https://github.com/JoCat/haste-server/commit/84338fd81db05b941f4b09f1120cdbd8efa79176), although I need to modify the code a little more |
Thanks for that @JoCat, your fix worked for me. |
This PR is stale because it has been open for 30 days with no activity. |
Starting from version 3 of MongoDB Driver, you need to separately specify the connection address and select the table using
client.db('db_name')