メインコンテンツまでスキップ
非公開のページ
このページは非公開です。 検索対象外となり、このページのリンクに直接アクセスできるユーザーのみに公開されます。

Query Engine API

Strapi のバックエンドは、データベース層をより低いレベルで操作するための Query Engine API を提供します。

Caution

In most cases you should not use the Query Engine API and rather use the Document Service API.

Only use the Query Engine API if you exactly know what you are doing, for instance if you want to use a lower-level API that directly interacts with unique rows of the database.

Please keep in mind that the Query Engine API is not aware of the most advanced Strapi 5 features like Draft & Publish, Internationalization, Content History, and possibly more. This also means that the Query Engine API will not be able to use documentId and will use id, which means it could lead to unattended consequences at the database level or partial or incomplete compatibility with Strapi 5 features.

Prerequisites

Before diving deeper into the Query Engine API documentation, it is recommended that you read the following introductions:

基本的な使い方

Query Engine は strapi.db.query から利用します。

strapi.db.query('api::blog.article').findMany({ // uid 構文: 'api::api-name.content-type-name'
where: {
title: {
$startsWith: '2021',
$endsWith: 'v4',
},
},
populate: {
category: true,
},
});

利用できる操作

Query Engine API でデータベースのエントリに対して次の操作ができます。