Skip to content

Commit c457e2b

Browse files
committed
merged 2.0 branch
2 parents d34f6eb + a63e9a1 commit c457e2b

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

lib/aggregation_cursor.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ var AggregationCursor = function(bson, ns, cmd, options, topology, topologyOptio
139139
// Inherit from Readable
140140
inherits(AggregationCursor, Readable);
141141

142-
// // Map core cursor _next method so we can apply mapping
143-
// CoreCursor.prototype._next = CoreCursor.prototype.next;
144-
145142
// Extend the Cursor
146143
for(var name in CoreCursor.prototype) {
147144
AggregationCursor.prototype[name] = CoreCursor.prototype[name];

lib/command_cursor.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ inherits(CommandCursor, Readable);
143143
var methodsToInherit = ['_next', 'next', 'each', 'forEach', 'toArray'
144144
, 'rewind', 'bufferedCount', 'readBufferedDocuments', 'close', 'isClosed'];
145145

146-
// // Map core cursor _next method so we can apply mapping
147-
// CoreCursor.prototype._next = CoreCursor.prototype.next;
148-
149146
// Only inherit the types we need
150147
for(var i = 0; i < methodsToInherit.length; i++) {
151148
CommandCursor.prototype[methodsToInherit[i]] = CoreCursor.prototype[methodsToInherit[i]];

lib/cursor.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,16 @@ var loop = function(self, callback) {
524524
return loop;
525525
}
526526

527+
/**
528+
* Get the next available document from the cursor, returns null if no more documents are available.
529+
* @method
530+
* @param {Cursor~resultCallback} callback The result callback.
531+
* @throws {MongoError}
532+
* @deprecated
533+
* @return {Promise} returns Promise if no callback passed
534+
*/
535+
Cursor.prototype.next = Cursor.prototype.nextObject;
536+
527537
/**
528538
* Iterates over all the documents for this cursor. As with **{cursor.toArray}**,
529539
* not all of the elements will be iterated if this cursor had been previouly accessed.

test/functional/cursor_tests.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ exports.cursorShouldBeAbleToResetOnToArrayRunningQueryAgain = {
1919

2020
collection.insert({'a':1}, configuration.writeConcernMax(), function(err, ids) {
2121
var cursor = collection.find({});
22+
console.log("--------------------------------- TOARRAY 0")
2223
cursor.toArray(function(err, items) {
24+
console.log("--------------------------------- TOARRAY 1")
2325
// Should fail if called again (cursor should be closed)
2426
cursor.toArray(function(err, items) {
2527
test.equal(null, err);

0 commit comments

Comments
 (0)