@@ -124,9 +124,10 @@ public static function provideQueryBuilderToMql(): iterable
124124 ];
125125
126126 // Nested array are not flattened like in the Eloquent builder. MongoDB can compare objects.
127+ // When id is used as data field name, it's not converted to _id
127128 $ array = [['issue ' => 45582 ], ['id ' => 2 ], [3 ]];
128129 yield 'whereIn nested array ' => [
129- ['find ' => [['id ' => ['$in ' => $ array ]], []]],
130+ ['find ' => [['_id ' => ['$in ' => $ array ]], []]],
130131 fn (Builder $ builder ) => $ builder ->whereIn ('id ' , $ array ),
131132 ];
132133
@@ -170,7 +171,7 @@ public static function provideQueryBuilderToMql(): iterable
170171
171172 /** @see DatabaseQueryBuilderTest::testEmptyWhereIns */
172173 yield 'whereIn empty array ' => [
173- ['find ' => [['id ' => ['$in ' => []]], []]],
174+ ['find ' => [['_id ' => ['$in ' => []]], []]],
174175 fn (Builder $ builder ) => $ builder ->whereIn ('id ' , []),
175176 ];
176177
@@ -553,12 +554,12 @@ function (Builder $builder) {
553554
554555 /** @see DatabaseQueryBuilderTest::testWhereBetweens() */
555556 yield 'whereBetween array of numbers ' => [
556- ['find ' => [['id ' => ['$gte ' => 1 , '$lte ' => 2 ]], []]],
557+ ['find ' => [['_id ' => ['$gte ' => 1 , '$lte ' => 2 ]], []]],
557558 fn (Builder $ builder ) => $ builder ->whereBetween ('id ' , [1 , 2 ]),
558559 ];
559560
560561 yield 'whereBetween nested array of numbers ' => [
561- ['find ' => [['id ' => ['$gte ' => [1 ], '$lte ' => [2 , 3 ]]], []]],
562+ ['find ' => [['_id ' => ['$gte ' => [1 ], '$lte ' => [2 , 3 ]]], []]],
562563 fn (Builder $ builder ) => $ builder ->whereBetween ('id ' , [[1 ], [2 , 3 ]]),
563564 ];
564565
@@ -579,7 +580,7 @@ function (Builder $builder) {
579580 ];
580581
581582 yield 'whereBetween collection ' => [
582- ['find ' => [['id ' => ['$gte ' => 1 , '$lte ' => 2 ]], []]],
583+ ['find ' => [['_id ' => ['$gte ' => 1 , '$lte ' => 2 ]], []]],
583584 fn (Builder $ builder ) => $ builder ->whereBetween ('id ' , collect ([1 , 2 ])),
584585 ];
585586
0 commit comments