Skip to content
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

updated to support mongodb v3.2 and above #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rohantarai
Copy link
Contributor

@rohantarai rohantarai commented Dec 3, 2019

the codes were obsolete and were not supported with latest mongodb versions so i have updated the code to support mongodb v3.2 and above.

};

options.options = options.options || {};

if (isNew) {
defaultOpt.autoReconnect = false;
// autoReconnect needs to be true to reconnect on failure, by default it is true in node-mongodb-native driver v2.2 and above
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is intentionally set to false,
cloud-native environment, if there is no connection to the db, the process is killed...

@@ -210,7 +218,7 @@ _.extend(MongoSessionStore.prototype, {

if (!this.options.ignoreConcurrency) sess._hash = new ObjectID().toString();

this.sessions.update(query, sess, { upsert: true, safe: true }, function(err, modifiedCount) {
this.sessions.updateOne(query, { $set: sess }, { upsert: true }, function(err, modifiedCount) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write it backwards compatible?
i.e. if typeof this.sessions.updateOne === 'function' ? updateOne : update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants