Socket
Socket
Sign inDemoInstall

mongodb-core

Package Overview
Dependencies
2
Maintainers
3
Versions
177
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.4 to 3.0.5

10

HISTORY.md

@@ -0,1 +1,11 @@

<a name="3.0.5"></a>
## [3.0.5](https://github.com/mongodb-js/mongodb-core/compare/v3.0.4...v3.0.5) (2018-03-14)
### Features
* **sessions:** adding implicit cursor session support ([1607321](https://github.com/mongodb-js/mongodb-core/commit/1607321))
<a name="3.0.4"></a>

@@ -2,0 +12,0 @@ ## [3.0.4](https://github.com/mongodb-js/mongodb-core/compare/v3.0.3...v3.0.4) (2018-03-05)

63

lib/cursor.js

@@ -174,2 +174,23 @@ 'use strict';

Cursor.prototype._endSession = function(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options = options || {};
const session = this.cursorState.session;
if (session && (options.force || session.owner === this)) {
this.cursorState.session = undefined;
session.endSession(callback);
return true;
}
if (callback) {
callback();
}
return false;
};
//

@@ -479,11 +500,7 @@ // Handle callback (including any exceptions thrown)

if (self.pool && self.pool.isDestroyed()) {
self.cursorState.notified = true;
self.cursorState.killed = true;
self.cursorState.documents = [];
self.cursorState.cursorIndex = 0;
callback(
new MongoNetworkError(
f('connection to host %s:%s was destroyed', self.pool.host, self.pool.port)
)
const err = new MongoNetworkError(
f('connection to host %s:%s was destroyed', self.pool.host, self.pool.port)
);
_setCursorNotifiedImpl(self, () => callback(err));
return true;

@@ -501,7 +518,4 @@ }

if (self.cursorState.dead && !self.cursorState.killed) {
self.cursorState.notified = true;
self.cursorState.killed = true;
self.cursorState.documents = [];
self.cursorState.cursorIndex = 0;
handleCallback(callback, null, null);
setCursorNotified(self, callback);
return true;

@@ -530,6 +544,3 @@ }

if (self.cursorState.killed) {
self.cursorState.notified = true;
self.cursorState.documents = [];
self.cursorState.cursorIndex = 0;
handleCallback(callback, null, null);
setCursorNotified(self, callback);
return true;

@@ -546,6 +557,3 @@ }

self.cursorState.dead = true;
self.cursorState.notified = true;
self.cursorState.documents = [];
self.cursorState.cursorIndex = 0;
handleCallback(callback, null, null);
setCursorNotified(self, callback);
};

@@ -557,6 +565,13 @@

var setCursorNotified = function(self, callback) {
_setCursorNotifiedImpl(self, () => handleCallback(callback, null, null));
};
var _setCursorNotifiedImpl = function(self, callback) {
self.cursorState.notified = true;
self.cursorState.documents = [];
self.cursorState.cursorIndex = 0;
handleCallback(callback, null, null);
if (self._endSession) {
return self._endSession(undefined, () => callback());
}
return callback();
};

@@ -663,2 +678,6 @@

if (self.cursorState.cursorId && self.cursorState.cursorId.isZero() && self._endSession) {
self._endSession();
}
if (

@@ -706,2 +725,6 @@ self.cursorState.documents.length === 0 &&

if (self.cursorState.cursorId && self.cursorState.cursorId.isZero() && self._endSession) {
self._endSession();
}
// Save the returned connection to ensure all getMore's fire over the same connection

@@ -708,0 +731,0 @@ self.connection = connection;

@@ -42,2 +42,5 @@ 'use strict';

this.operationTime = null;
this.explicit = !!options.explicit;
this.owner = options.owner;
}

@@ -44,0 +47,0 @@

{
"name": "mongodb-core",
"version": "3.0.4",
"version": "3.0.5",
"description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc