As said before, mongoose custom types are not supported by the agent.
The error is due to the frontend breaking because there is an unknown “ObjectIdOrString” type in the schema.
Here is a new version of the patch that will fix that issue
However, keep in mind that other issues will happen for sure at some point and you would be better off with not having a mixed type primary key in your models (for forest admin usage at least).
diff --git a/node_modules/forest-express-mongoose/dist/adapters/mongoose.js b/node_modules/forest-express-mongoose/dist/adapters/mongoose.js
index f1048a0..56061a0 100644
--- a/node_modules/forest-express-mongoose/dist/adapters/mongoose.js
+++ b/node_modules/forest-express-mongoose/dist/adapters/mongoose.js
@@ -203,7 +203,7 @@ module.exports = /*#__PURE__*/function () {
return null;
} // Deal with primitive type
-
+ if (fieldInfo.instance === 'StringOrObjectId') return 'String'
return fieldInfo.instance || fieldInfo.options && getTypeFromNative(fieldInfo.options.type) || null;
};
diff --git a/node_modules/forest-express-mongoose/dist/services/filters-parser.js b/node_modules/forest-express-mongoose/dist/services/filters-parser.js
index cd7a2d1..76bccab 100644
--- a/node_modules/forest-express-mongoose/dist/services/filters-parser.js
+++ b/node_modules/forest-express-mongoose/dist/services/filters-parser.js
@@ -189,6 +189,7 @@ function FiltersParser(model, timezone, options) {
return parseObjectId;
default:
+ if (type.prototype.cast) return value => type.prototype.cast(value);
return parseOther;
}
};