File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -1025,11 +1025,11 @@ export class MongoEntityManager extends EntityManager {
10251025 cursor : FindCursor < Entity > | AggregationCursor < Entity > ,
10261026 ) {
10271027 const queryRunner = this . mongoQueryRunner
1028- cursor . toArray = ( ) =>
1029- cursor
1030- . clone ( )
1031- . toArray ( )
1032- . then ( async ( results : Entity [ ] ) => {
1028+
1029+ ; ( cursor as any ) [ "__to_array_func" ] = cursor . toArray
1030+ cursor . toArray = async ( ) =>
1031+ ( ( cursor as any ) [ "__to_array_func" ] as CallableFunction ) ( ) . then (
1032+ async ( results : Entity [ ] ) => {
10331033 const transformer = new DocumentToEntityTransformer ( )
10341034 const entities = transformer . transformAll ( results , metadata )
10351035 // broadcast "load" events
@@ -1039,13 +1039,12 @@ export class MongoEntityManager extends EntityManager {
10391039 entities ,
10401040 )
10411041 return entities
1042- } )
1043-
1044- cursor . next = ( ) =>
1045- cursor
1046- . clone ( )
1047- . next ( )
1048- . then ( async ( result : Entity ) => {
1042+ } ,
1043+ )
1044+ ; ( cursor as any ) [ "__next_func" ] = cursor . next
1045+ cursor . next = async ( ) =>
1046+ ( ( cursor as any ) [ "__next_func" ] as CallableFunction ) ( ) . then (
1047+ async ( result : Entity ) => {
10491048 if ( ! result ) {
10501049 return result
10511050 }
@@ -1056,7 +1055,8 @@ export class MongoEntityManager extends EntityManager {
10561055 entity ,
10571056 ] )
10581057 return entity
1059- } )
1058+ } ,
1059+ )
10601060 }
10611061
10621062 protected filterSoftDeleted < Entity > (
You can’t perform that action at this time.
0 commit comments