| 2786 | |
| 2787 | |
| 2788 | static bool |
| 2789 | AreIndexOptionsStillEquivalent(const char *path, const bson_value_t *left, |
| 2790 | const bson_value_t *right) |
| 2791 | { |
| 2792 | bool areEquivalent = true; |
| 2793 | if (IsOptionsKeyOrderedIndex(path)) |
| 2794 | { |
| 2795 | if (left != NULL || right != NULL) |
| 2796 | { |
| 2797 | bool enableCompositeTermLeft = false; |
| 2798 | bool enableCompositeTermRight = false; |
| 2799 | |
| 2800 | if (left != NULL) |
| 2801 | { |
| 2802 | enableCompositeTermLeft = BsonValueAsBool(left); |
| 2803 | } |
| 2804 | if (right != NULL) |
| 2805 | { |
| 2806 | enableCompositeTermRight = BsonValueAsBool(right); |
| 2807 | } |
| 2808 | |
| 2809 | areEquivalent = enableCompositeTermLeft == enableCompositeTermRight; |
| 2810 | } |
| 2811 | } |
| 2812 | |
| 2813 | if (areEquivalent && strcmp(path, "buildAsUnique") == 0) |
| 2814 | { |
| 2815 | if (left != NULL || right != NULL) |
| 2816 | { |
| 2817 | bool buildAsUniqueLeft = false; |
| 2818 | bool buildAsUniqueRight = false; |
| 2819 | |
| 2820 | if (left != NULL) |
| 2821 | { |
| 2822 | buildAsUniqueLeft = BsonValueAsBool(left); |
| 2823 | } |
| 2824 | if (right != NULL) |
| 2825 | { |
| 2826 | buildAsUniqueRight = BsonValueAsBool(right); |
| 2827 | } |
| 2828 | |
| 2829 | areEquivalent = buildAsUniqueLeft == buildAsUniqueRight; |
| 2830 | } |
| 2831 | } |
| 2832 | |
| 2833 | if (areEquivalent && strcmp(path, "collation") == 0) |
| 2834 | { |
| 2835 | if (left == NULL || right == NULL) |
| 2836 | { |
| 2837 | areEquivalent = left == right; |
| 2838 | } |
| 2839 | else |
| 2840 | { |
| 2841 | areEquivalent = BsonValueEquals(left, right); |
| 2842 | } |
| 2843 | } |
| 2844 | |
| 2845 | return areEquivalent; |
no test coverage detected