From bd9c757ce94732cf21440a4cbed8afd36a4b87d6 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Thu, 14 Sep 2023 17:52:59 +0200 Subject: [PATCH] RUBY-3372 Fix failing explain tests --- spec/mongo/collection/view/aggregation_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/mongo/collection/view/aggregation_spec.rb b/spec/mongo/collection/view/aggregation_spec.rb index 7657460697..da363d9992 100644 --- a/spec/mongo/collection/view/aggregation_spec.rb +++ b/spec/mongo/collection/view/aggregation_spec.rb @@ -321,7 +321,12 @@ min_server_fcv '4.2' let(:result) do - aggregation.explain['queryPlanner']['collation']['locale'] + if aggregation.explain.key?('queryPlanner') + aggregation.explain['queryPlanner']['collation']['locale'] + else + # 7.2+ sharded cluster + aggregation.explain['shards'].first.last['queryPlanner']['collation']['locale'] + end end it_behaves_like 'applies the collation'