Nested enums not keeping type

Feature(s) impacted

Nested fields

Observed behavior

I have an object with a nested field. The nested field is defined as an enum in Mongoose.
When I display that field in Forest Admin, the field is of type String (see attached picture).

Is there no way to keep nested fields as enums? If I flatten only this one field, I get an error when updating that field + any other from the nested object, as the datasource’s unflattenRecord(patch, asFields, patchMode=true) turns the flattened key into a dotted key, producing a single updateOne patch of:

{ dmsIdentifier: {storeId: …}, "dmsIdentifier.type": "xxx" }

which MongoDB does not accept.

Expected behavior

Nested fields should be enums. This used to work fine in `forest-express-mongoose`

Context

  • Project name: AutoHub
  • Team name: …
  • Environment name: AutoHub
  • Database type: MongoDb
  • Recent changes made on your end if any: Upgrade from forest-express-mongoose to @forestadmin/agent

And, if you are self-hosting your agent:

  • Agent technology: NodeJS

  • Agent (forest package) name & version (from your .lock file):
    @forestadmin/agent”: “^1.79.5”,

    "@forestadmin/datasource-mongoose": "^1.13.4",
    

Hi @aniznik :waving_hand: apologies for the delay.
A fix is coming, i will keep you posted when it’s released.

Hey @aniznik we have released the fix.
Please upgrade your @forestadmin packages version accordingly

  • @forestadmin/datasource-mongoose 1.14.0
  • @forestadmin/agent 1.88.0

Let me know :folded_hands: