File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 27
27
use MongoDB \Exception \InvalidArgumentException ;
28
28
use MongoDB \Exception \UnexpectedValueException ;
29
29
use MongoDB \Exception \UnsupportedException ;
30
- use MongoDB \Model \TypeMapArrayIterator ;
31
30
use ArrayIterator ;
32
31
use stdClass ;
33
32
use Traversable ;
@@ -280,16 +279,16 @@ public function execute(Server $server)
280
279
return $ cursor ;
281
280
}
282
281
282
+ if (isset ($ this ->options ['typeMap ' ])) {
283
+ $ cursor ->setTypeMap (\MongoDB \create_field_path_type_map ($ this ->options ['typeMap ' ], 'result.$ ' ));
284
+ }
285
+
283
286
$ result = current ($ cursor ->toArray ());
284
287
285
288
if ( ! isset ($ result ->result ) || ! is_array ($ result ->result )) {
286
289
throw new UnexpectedValueException ('aggregate command did not return a "result" array ' );
287
290
}
288
291
289
- if (isset ($ this ->options ['typeMap ' ])) {
290
- return new TypeMapArrayIterator ($ result ->result , $ this ->options ['typeMap ' ]);
291
- }
292
-
293
292
return new ArrayIterator ($ result ->result );
294
293
}
295
294
You can’t perform that action at this time.
0 commit comments