On the 7.6 branch, any_of with more than one hash criterion bypasses the query-operator guard, so that (e.g.) Band.any_of({'$where' => '...'}, {name: 'x'}) builds a selector containing a top-level $where even when Mongoid.allow_unsafe_query_operators is false.
Reproduction (7.6, allow_unsafe_query_operators = false):
Band.any_of({'$where' => 'this.name == "admin"'}, {name: 'x'}).selector
# => {"$or" => [{"$where" => "..."}, {"name" => "x"}]}