@@ -617,6 +617,16 @@ public function dataIsMongoIndexEquivalentToDocumentIndex()
617
617
'mongoIndex ' => ['key ' => ['foo ' => 1 ]],
618
618
'documentIndex ' => ['keys ' => ['foo ' => -1 ]],
619
619
],
620
+ 'compoundIndexKeysSame ' => [
621
+ 'expected ' => true ,
622
+ 'mongoIndex ' => ['key ' => ['foo ' => 1 , 'baz ' => 1 ]],
623
+ 'documentIndex ' => ['keys ' => ['foo ' => 1 , 'baz ' => 1 ]],
624
+ ],
625
+ 'compoundIndexKeysSameDifferentOrder ' => [
626
+ 'expected ' => false ,
627
+ 'mongoIndex ' => ['key ' => ['foo ' => 1 , 'baz ' => 1 ]],
628
+ 'documentIndex ' => ['keys ' => ['baz ' => 1 , 'foo ' => 1 ]],
629
+ ],
620
630
// Sparse option
621
631
'sparseOnlyInMongoIndex ' => [
622
632
'expected ' => false ,
@@ -823,34 +833,45 @@ public function dataIsMongoTextIndexEquivalentToDocumentIndex()
823
833
],
824
834
'compoundIndexKeysSameAndWeightsSame ' => [
825
835
'expected ' => true ,
836
+ 'mongoIndex ' => [
837
+ 'key ' => ['a ' => -1 , '_fts ' => 'text ' , '_ftsx ' => 1 , 'd ' => 1 ],
838
+ 'weights ' => ['b ' => 1 , 'c ' => 2 ],
839
+ ],
840
+ 'documentIndex ' => [
841
+ 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
842
+ 'options ' => ['weights ' => ['b ' => 1 , 'c ' => 2 ]],
843
+ ],
844
+ ],
845
+ 'compoundIndexKeysDifferentOrder ' => [
846
+ 'expected ' => false ,
826
847
'mongoIndex ' => [
827
848
'key ' => ['_fts ' => 'text ' , '_ftsx ' => 1 , 'a ' => -1 , 'd ' => 1 ],
828
849
'weights ' => ['b ' => 1 , 'c ' => 2 ],
829
850
],
830
851
'documentIndex ' => [
831
- 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
852
+ 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
832
853
'options ' => ['weights ' => ['b ' => 1 , 'c ' => 2 ]],
833
854
],
834
855
],
835
856
'compoundIndexKeysSameAndWeightsDiffer ' => [
836
857
'expected ' => false ,
837
858
'mongoIndex ' => [
838
- 'key ' => ['_fts ' => ' text ' , '_ftsx ' => 1 , 'a ' => - 1 , 'd ' => 1 ],
859
+ 'key ' => ['a ' => - 1 , '_fts ' => ' text ' , '_ftsx ' => 1 , 'd ' => 1 ],
839
860
'weights ' => ['b ' => 1 , 'c ' => 2 ],
840
861
],
841
862
'documentIndex ' => [
842
- 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
863
+ 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
843
864
'options ' => ['weights ' => ['b ' => 3 , 'c ' => 2 ]],
844
865
],
845
866
],
846
867
'compoundIndexKeysDifferAndWeightsSame ' => [
847
868
'expected ' => false ,
848
869
'mongoIndex ' => [
849
- 'key ' => ['_fts ' => ' text ' , '_ftsx ' => 1 , 'a ' => 1 , 'd ' => 1 ],
870
+ 'key ' => ['a ' => 1 , '_fts ' => ' text ' , '_ftsx ' => 1 , 'd ' => 1 ],
850
871
'weights ' => ['b ' => 1 , 'c ' => 2 ],
851
872
],
852
873
'documentIndex ' => [
853
- 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
874
+ 'keys ' => ['a ' => -1 , 'b ' => 'text ' , 'c ' => 'text ' , 'd ' => 1 ],
854
875
'options ' => ['weights ' => ['b ' => 1 , 'c ' => 2 ]],
855
876
],
856
877
],
0 commit comments