Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @event Cursor#close
* @type {null}
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
// Execute using callback
if(typeof callback == 'function') {
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
// Execute using callback
* @event Cursor#close
* @type {null}
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
* @event Cursor#close
* @type {null}
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
* @event Cursor#close
* @type {null}
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
Cursor.prototype._next = function() {
if (this._initImplicitSession) {
this._initImplicitSession();
}
return CoreCursor.prototype.next.apply(this, arguments);
};
for (let name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
Cursor.prototype._initImplicitSession = function() {
if (!this.s.explicitlyIgnoreSession && !this.s.session && this.s.topology.hasSessionSupport()) {
this.s.session = this.s.topology.startSession({ owner: this });
this.cursorState.session = this.s.session;
}
};
Cursor.prototype._endSession = function() {
const didCloseCursor = CoreCursor.prototype._endSession.apply(this, arguments);
if (didCloseCursor) {
this.s.session = undefined;
}
};
* @event Cursor#close
* @type {null}
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
// Execute using callback
*/
/**
* Cursor stream readable event
*
* @event Cursor#readable
* @type {null}
*/
// Inherit from Readable
inherits(Cursor, Readable);
// Map core cursor _next method so we can apply mapping
CoreCursor.prototype._next = CoreCursor.prototype.next;
for(var name in CoreCursor.prototype) {
Cursor.prototype[name] = CoreCursor.prototype[name];
}
var define = Cursor.define = new Define('Cursor', Cursor, true);
/**
* Check if there is any document still available in the cursor
* @method
* @param {Cursor~resultCallback} [callback] The result callback.
* @throws {MongoError}
* @return {Promise} returns Promise if no callback passed
*/
Cursor.prototype.hasNext = function(callback) {
var self = this;
// Execute using callback