Skip to content

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.


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...

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