# 权限提供者实例的 getWhere() 方法已被移除

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/get-where-removed

🌐 The `getWhere()` method for permission provider instances has been removed

在 Strapi 5 中，权限提供者实例的 `getWhere()` 方法已被移除；请改用带有自定义谓词的 `provider.values().filter()` 来查询和匹配提供者项。

🌐 The `getWhere()` method for permission provider instances has been removed in Strapi 5; use `provider.values().filter()` with a custom predicate instead to query and match provider items.

在 Strapi 5 中，权限提供者实例的 `getWhere()` 方法已被移除，用户应先获取提供者的值，然后进行过滤。

🌐 In Strapi 5, the `getWhere()` method for permission provider instances has been removed, and users should first get the provider values, then filter them.

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? Yes
- Is this breaking change automatically handled by a codemod? No

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

提供一个浏览器名称来代替默认名称，XX1 表示停止打开浏览器。

🌐 Provider instances (action provider, condition provider, etc…) are built using a provider factory.

这些提供商有一个 `getWhere` 方法，允许你查询符合特定条件的提供商项目并返回它们。

🌐 Those providers have a `getWhere` method allowing you to query provider’s items that match certain conditions and return them.

查询是一个对象，其中键和值与提供程序条目匹配：

🌐 The query was an object where keys and values were matched with the provider entries:

```js
const values = provider.getWhere({ foo: 42, bar: 'baz' });
```

<br/>

**在 Strapi 5 中**

你需要采用更传统的方法，首先获取提供商值，然后使用自定义谓词对其进行过滤：

🌐 You need to adopt a more conventional approach by first getting the provider values, then filtering them using a custom predicate:

```js
const values = provider.values().filter(value => value.foo === 42 && value.bar === 'baz');
```

## 迁移 {#migration}

🌐 Migration

<br/>

### 手动操作 {#manual-procedure}

🌐 Manual procedure

如果使用 `getWhere()` 方法，用户需要手动更新他们的代码，可以参考以下示例：

🌐 Users need to manually update their code if using the `getWhere()` method, using the following example as a guide:

**在 Strapi v4 中**

```tsx
const values = provider.getWhere({ foo: 42, bar: 'baz' });
```

<br/>

**在 Strapi 5 中**

```tsx
const values = provider.values().filter(
  value => value.foo === 42 && value.bar === 'baz'
);
```
