# Nested documents are displayed as "\[Object object\]" in Document Details on admin panel

**URL:** <https://community.forestadmin.com/t/nested-documents-are-displayed-as-object-object-in-document-details-on-admin-panel/497>\
**Category:** Help me!\
**Created:** [June 22, 2020, 5:41am UTC](https://community.forestadmin.com/t/nested-documents-are-displayed-as-object-object-in-document-details-on-admin-panel/497 "2020-06-22T05:41:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artem\_Nazarenko](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/artem_nazarenko/32/382_2.png) [@Artem\_Nazarenko](https://community.forestadmin.com/u/Artem_Nazarenko)\
**Post date:** [June 22, 2020, 5:41am UTC](https://community.forestadmin.com/t/nested-documents-are-displayed-as-object-object-in-document-details-on-admin-panel/497/1 "2020-06-22T05:41:12Z")

</div>

## Expected behavior

[https://docs.forestadmin.com/documentation/reference-guide/models/enrich-your-models#managing-nested-documents-in-mongoose](https://docs.forestadmin.com/documentation/reference-guide/models/enrich-your-models#managing-nested-documents-in-mongoose)

## Actual Behavior

I have a field described in Mongoose schema as:

```javascript
  'gallery': {
    'thumbnail': {
        'url': String,
        'cloudId': String,
        'type': String,
        'duration': Number,
        'size': Number,
    },
  },

```

For some reason I see this field in .forestadmin-schema.json as:

```javascript
{
      "field": "gallery",
      "type": {
        "fields": [{
          "field": "thumbnail",
          "type": "String"
        }]
},

```

And it looks like this in admin panel:

![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/1X/bf05616a7dc7ec5b4d74b459e2ac8bd1dd805638.png)

So I can’t view or edit this nested document. But the most annoying thing that I can’t edit my document at all, because every time I save it I lose gallery.thumbnail field as it’s rewritten with “[object Object]” in my database.

## Context

Please provide any relevant information about your setup.

- Express Version: ~4.16.3
- Database Dialect: Mongodb  
MongoDB server version: 3.6.12

---

<div class="post-metadata">

**Author:** ![arnaud](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud/32/32_2.png) [@arnaud](https://community.forestadmin.com/u/arnaud)\
**Post date:** [June 22, 2020, 9:35am UTC](https://community.forestadmin.com/t/nested-documents-are-displayed-as-object-object-in-document-details-on-admin-panel/497/2 "2020-06-22T09:35:11Z")

</div>

Hi @Artem_Nazarenko,

I think you issue comes from the fact that `type` is a “reserved” keyword in Mongoose:  
[https://mongoosejs.com/docs/schematypes.html#type-key](https://mongoosejs.com/docs/schematypes.html#type-key)

Can you try to edit you schema this way:

```javascript
  'gallery': {
    'thumbnail': {
        'url': String,
        'cloudId': String,
        'type': { type: String },
        'duration': Number,
        'size': Number,
    },
  },

```

and let us know if it fixes your issue 🙏

---

<div class="post-metadata">

**Author:** ![Artem\_Nazarenko](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/artem_nazarenko/32/382_2.png) [@Artem\_Nazarenko](https://community.forestadmin.com/u/Artem_Nazarenko)\
**Post date:** [June 22, 2020, 6:33pm UTC](https://community.forestadmin.com/t/nested-documents-are-displayed-as-object-object-in-document-details-on-admin-panel/497/3 "2020-06-22T18:33:50Z")

</div>

Hi @arnaud,

It worked! Thank you for the help!
