Display array of objects

Observed behavior

I’m trying to display array of messages, in my collection it looks like this

In models/gptchats.ts message field have type Array<Object>

import Mongoose from ‘mongoose’;

interface GptChatsInterface {
dateOfUse: Date;
user: Mongoose.Types.ObjectId;
chatId: number;
messages: Array;
model: String;

const gptChatsSchema = new Mongoose.Schema({
dateOfUse: Date,
user: { type: Mongoose.Schema.Types.ObjectId, ref: ‘users’ },
chatId: Number,
messages: Array,
model: String,
}, {
timestamps: false,
export { GptChatsInterface, gptChatsSchema };

in .forestadmin-schema.json file message field look like this

      "defaultValue": null,
      "enums": [],
      "field": "messages",
      "integration": null,
      "inverseOf": null,
      "isFilterable": true,
      "isPrimaryKey": false,
      "isReadOnly": false,
      "isRequired": false,
      "isSortable": true,
      "isVirtual": false,
      "reference": null,
      "type": [],
      "validations": []

But in admin panel…

Expected behavior

I want the forest administrator to display messages like it does in mongo Compass.

Failure Logs


  • Project name: LetAi

  • Team name: Operations

  • Environment name: Development

  • Agent (forest package) name & version:

    “dotenv”: “^16.0.1”,
    @forestadmin/agent”: “^1.0.0”,
    @forestadmin/datasource-mongoose”: “^1.0.0”,
    “mongoose”: “^6.10.3”
    “nodemon”: “^2.0.12”,
    “typescript”: “^4.9.4”,
    “ts-node”: “^10.9.1”

Hi @BelieveMePls and welcome to our community !

You have two ways of displaying an array of nested objects.

  1. Use the JSON widget in your collection.
  2. Have a collection for embedded objects in your array. Here is the documentation to see an example with the same use case as yours.

Best regards,