mongodb/node-mongodb-native — pull request #1201 by KenPowers (2014-08-20 02:40:25+00:00)
Title: Remove duplicate Cursor constructor

This is a pull request to fix [NODE-246](https://jira.mongodb.org/browse/NODE-246).

`scope.js` had its own `Cursor` constructor which was used instead of the exposed `require('mongo').Cursor` example. [This caused problems with people who wanted to promisify their cursors.](http://stackoverflow.com/questions/23771853/how-can-i-promisify-the-mongodb-native-javascript-driver-using-bluebird)

This pull request removes the duplicate constructor and adds a `cloneWithOptions` static method to the remaining `Cursor` constructor. This also improves efficiency (the duplicate constructor set properties on itself on every construction instead of utilizing the prototype chain) and removes a global leak which was present in the duplicate constructor.

There is also a new test to verify that the cursors returned are instances of the exposed `Cursor` constructor.