# Export is not working in my smart collection

**URL:** <https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807>\
**Category:** Help me!\
**Created:** [June 12, 2022, 8:57pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807 "2022-06-12T20:57:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [June 12, 2022, 8:57pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/1 "2022-06-12T20:57:39Z")

</div>

## Feature(s) impacted

Export csv action in my smart collection

## Observed behavior

I export csv but I have the following message →   
Export failed: Unexpected error. Please check your Admin API server logs.  
And nothing is printed in the logs except

GET /forest/datastudioCategoryFeaturesData.csv?fields%5BdatastudioCategoryFeaturesData%5D=id%2CcategoryName%2CproductId%2CsoftwareName%2CfeatureName%2CcategoryId%2CfeatureId&page%5Bnumber%5D=1&page%5Bsize%5D=15&filters=%7B%22field%22%3A%22categoryName%22%2C%22operator%22%3A%22equal%22%2C%22value%22%3A%22sales-tracking-software%22%7D&sort=-id&filename=datastudio+category+features+data&header=id%2Ccategory+name%2Cproduct+id%2Csoftware+name%2Cfeature+name%2Ccategory+id%2Cfeature+id&sessionToken=&timezone=Europe%2FZurich 404 180 - 6.321 ms

## Expected behavior

Download a csv of my smart collection

## Failure Logs

GET /forest/datastudioCategoryFeaturesData.csv?fields%5BdatastudioCategoryFeaturesData%5D=id%2CcategoryName%2CproductId%2CsoftwareName%2CfeatureName%2CcategoryId%2CfeatureId&page%5Bnumber%5D=1&page%5Bsize%5D=15&filters=%7B%22field%22%3A%22categoryName%22%2C%22operator%22%3A%22equal%22%2C%22value%22%3A%22sales-tracking-software%22%7D&sort=-id&filename=datastudio+category+features+data&header=id%2Ccategory+name%2Cproduct+id%2Csoftware+name%2Cfeature+name%2Ccategory+id%2Cfeature+id&sessionToken=&timezone=Europe%2FZurich 404 180 - 6.321 ms

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [June 13, 2022, 7:50am UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/2 "2022-06-13T07:50:33Z")

</div>

Hi @Charles_Touret👋 ,

Can I have your project name, your liana and its version, and the collection name that you are using ?  
It could also be useful to have the details of the smart collection.

Best,

Shohan

---

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [June 21, 2022, 7:04pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/4 "2022-06-21T19:04:08Z")

</div>

Hi @shohanr 🙂  
project\_name: Uniseed  
liana → 8.5.3 - forest-express-sequelize  
collection name (it’s a smart collection) → datastudioCategoryFeaturesData

Sorry for the time of answer thanks

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [June 22, 2022, 1:56pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/5 "2022-06-22T13:56:43Z")

</div>

Hi @Charles_Touret ,

In the case of a smart collection, you have to implement every route. This is also the case for the route GET “datastudioCategoryFeaturesData.csv”.

- It could be the issue if you are missing this route.
- This route will also need to overwrite the filters.

If your smart collection is a simple table, you can overwrite the routes with the default route proposed by forest :

> **[Default routes](https://docs.forestadmin.com/documentation/reference-guide/routes/default-routes#export-a-list-of-records)**
>
> ⚠️ This page is relevant only if you installed Forest Admin directly on a database (SQL/Mongodb). If you installed in a Rails app, the default routes are managed within your Rails app.

Otherwise it will be up to you to implement the logic of the request 🙂

Have a good day 👋

Best regards,

Shohan

---

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [June 27, 2022, 3:30pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/6 "2022-06-27T15:30:59Z")

</div>

Ok ! My problem if I want to do that is that I have to create the model link to the smart collection, is there a way to do it easily ?

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [June 29, 2022, 2:10pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/7 "2022-06-29T14:10:11Z")

</div>

To answer to that question I would need more information about the smart collection and its source.  
But you can try to use the [recordsExporter](https://docs.forestadmin.com/documentation/reference-guide/routes/default-routes#export-a-list-of-records) if your smart collection is a simple interface to a table.

Best,

Shohan

---

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [June 30, 2022, 1:38pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/8 "2022-06-30T13:38:03Z")

</div>

Yes amigo but look in the example your provide me, there is in parameter of the method recordsExporter the model, so I need to create the model of my smart collection to use it I think, no ?

---

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [July 7, 2022, 7:11am UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/9 "2022-07-07T07:11:57Z")

</div>

Any news on the subject ?

---

<div class="post-metadata">

**Author:** ![Charles\_Touret](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/charles_touret/32/4381_2.png) [@Charles\_Touret](https://community.forestadmin.com/u/Charles_Touret)\
**Post date:** [July 7, 2022, 7:33am UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/10 "2022-07-07T07:33:35Z")

</div>

Here is my smart collection code

```javascript
const { collection } = require('forest-express-sequelize');
const models = require('../models');

collection('datastudioCategoryFeaturesData', {
  isSearchable: true,
  fields: [
    {
        field: 'id',
        type: 'String',
    },
    {
        field: 'softwareName',
        type: 'String',
    }, {
        field: 'categoryId',
        type: 'Number',
    },
    {
        field: 'categoryName',
        type: 'String',
        isFilterable: true,
    },
    {
        field: 'productId',
        type: 'Number',
    },
    {
        field: 'featureId',
        type: 'String',
    },
    {
        field: 'featureName',
        type: 'String',
    }
  ],

});

```

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [August 2, 2022, 2:29pm UTC](https://community.forestadmin.com/t/export-is-not-working-in-my-smart-collection/4807/11 "2022-08-02T14:29:52Z")

</div>

Hey !

Sorry for the delay.  
The export is needed to be overwritten in your smart collection in the **route folder** not in the **forest folder**.

Best,

Shohan
