@@ -116,15 +116,7 @@ module.exports.makeLegacyFindCursor = function (baseClass) {
116116} ;
117117
118118module . exports . makeLegacyListCollectionsCursor = function ( baseClass ) {
119- class LegacyListCollectionsCursor extends baseClass {
120- constructor ( db , filter , options ) {
121- if ( db instanceof baseClass ) {
122- super ( db . parent , db . filter , db . options ) ;
123- } else {
124- super ( db , filter , options ) ;
125- }
126- }
127- }
119+ class LegacyListCollectionsCursor extends baseClass { }
128120
129121 for ( const [ name , method ] of commonCursorFunctions ) {
130122 Object . defineProperty ( LegacyListCollectionsCursor . prototype , name , {
@@ -136,23 +128,15 @@ module.exports.makeLegacyListCollectionsCursor = function (baseClass) {
136128 Object . defineProperty ( baseClass . prototype , toLegacy , {
137129 enumerable : false ,
138130 value : function ( ) {
139- return new LegacyListCollectionsCursor ( this ) ;
131+ return Object . setPrototypeOf ( this , LegacyListCollectionsCursor . prototype ) ;
140132 }
141133 } ) ;
142134
143135 return LegacyListCollectionsCursor ;
144136} ;
145137
146138module . exports . makeLegacyListIndexesCursor = function ( baseClass ) {
147- class LegacyListIndexesCursor extends baseClass {
148- constructor ( collection , options ) {
149- if ( collection instanceof baseClass ) {
150- super ( collection . parent , collection . options ) ;
151- } else {
152- super ( collection , options ) ;
153- }
154- }
155- }
139+ class LegacyListIndexesCursor extends baseClass { }
156140
157141 for ( const [ name , method ] of commonCursorFunctions ) {
158142 Object . defineProperty ( LegacyListIndexesCursor . prototype , name , {
@@ -164,7 +148,7 @@ module.exports.makeLegacyListIndexesCursor = function (baseClass) {
164148 Object . defineProperty ( baseClass . prototype , toLegacy , {
165149 enumerable : false ,
166150 value : function ( ) {
167- return new LegacyListIndexesCursor ( this ) ;
151+ return Object . setPrototypeOf ( this , LegacyListIndexesCursor . prototype ) ;
168152 }
169153 } ) ;
170154
0 commit comments