File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,10 @@ public function raw($value = null)
181
181
182
182
// Convert MongoCursor results to a collection of models.
183
183
if ($ results instanceof CursorInterface) {
184
- $ results ->setTypeMap (['root ' => 'array ' , 'document ' => 'array ' , 'array ' => 'array ' ]);
184
+ if (!config ('database.connections.mongodb.options.AggregateCollectionArray ' )){
185
+ $ results ->setTypeMap (['root ' => 'array ' , 'document ' => 'array ' , 'array ' => 'array ' ]);
186
+ }
187
+
185
188
$ results = $ this ->query ->aliasIdForResult (iterator_to_array ($ results ));
186
189
187
190
return $ this ->model ->hydrate ($ results );
Original file line number Diff line number Diff line change @@ -1667,6 +1667,9 @@ private function aliasIdForQuery(array $values): array
1667
1667
*/
1668
1668
public function aliasIdForResult (array |object $ values ): array |object
1669
1669
{
1670
+ if (config ('database.connections.mongodb.options.DisableAliasIdForResult ' )){
1671
+ return $ values ;
1672
+ }
1670
1673
if (is_array ($ values )) {
1671
1674
if (array_key_exists ('_id ' , $ values ) && ! array_key_exists ('id ' , $ values )) {
1672
1675
$ values ['id ' ] = $ values ['_id ' ];
You can’t perform that action at this time.
0 commit comments