diff --git a/README.md b/README.md index 492c7f3..3f6e1b9 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ const config = { } ``` -### readManyOption +### readByQueryOption -`readManyOption` match https://docs.directus.io/reference/sdk/#read-multiple-items +`readByQueryOption` match https://docs.directus.io/reference/sdk/#read-by-query ### Export to specific path @@ -73,9 +73,10 @@ const config = { contentKey: 'body', collections: { news: { - readManyOption: { + readByQueryOption: { fields: ['title', 'slug', 'date', 'image', 'image_credit', 'draft', 'body'], - filter: { draft: { _eq: 'false' } } + filter: { draft: { _eq: 'false' } }, + limit: -1 }, pathBuilder: (article) => { if (article.slug) { diff --git a/index.js b/index.js index 471e1bd..4526133 100644 --- a/index.js +++ b/index.js @@ -78,8 +78,8 @@ export default class DirectusToMarkdown { async export() { for (const collectionName in this.collections) { const collection = this.collections[collectionName] - const readManyOption = collection.readManyOption - const items = (await this.directus.items(collectionName).readMany(readManyOption)).data + const readByQueryOption = collection.readByQueryOption + const items = (await this.directus.items(collectionName).readByQuery(readByQueryOption)).data for (const item of items) { const itemPath = collection.pathBuilder(item) if (!fs.existsSync(itemPath)) {