New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support string initialization for map in schema #13755
Comments
import * as mongoose from 'mongoose';
const testSchema = new mongoose.Schema({
instance: {
type: 'Map',
of: 'Mixed',
default: new Map<string, any>()
}
}) |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Sorry for late reply, I was so busy for some reasons... It looks like my issue seems like typescript problem.
This is actual error message what I saw. I'll just make minimal project ASAP. Thanks for focusing on this |
class Test {
instance: Map<string, string>
constructor() {
this.instance = new Map<string, string>()
}
}
const testSchema = new mongoose.Schema<Test>({
instance: {
type: 'Map',
of: 'Mixed',
default: new Map<string, string>()
}
}) This is minimal reproduction script |
types(schematypes): allow defining map path using `type: 'Map'` in addition to `type: Map`
Prerequisites
🚀 Feature Proposal
My project uses String for setting the type in schema of each keys like this:
In case of map, I just tried this style of code:
This is working code. But if I use 'Map' instead of
Schema.Types.Map
, compiler aborts to compile.So, is it able to allow with setting the map type with String?
Motivation
No response
Example
No response
The text was updated successfully, but these errors were encountered: