Type error when creating index: Argument of type '{ xpto : 1}' is not assignable to parameter of type 'xpto' does not exist in type 'IndexSpecification'. #983
[ ] Regression
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When configuring schema.index at object instance returned by SchemaFactory.createForClass its returns a error during dev runtime. The type of first argument of schema was any and now has type of IndexSpecification.
Expected behavior
I always declare a compound index using this sintax XptoSchema.index({ field1 : 1, field2 : 1 },{ unique:true }) but now I'm getting this trouble described below.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Nest version: X.Y.Z
"@nestjs/common": "^8.0.6",
"@nestjs/config": "^1.0.1",
"@nestjs/core": "^8.0.6",
"@nestjs/mongoose": "^8.0.0"
For Tooling issues:
- Node version: XX
- Platform:
NODE: v14.16.0
Platform: MAC OS BIG SUR
Others:
Error when creating schema index.
Current behavior
When configuring
schema.index
at object instance returned bySchemaFactory.createForClass
its returns a error during dev runtime. The type of first argument ofschema
was any and now has type of IndexSpecification.Expected behavior
I always declare a compound index using this sintax
XptoSchema.index({ field1 : 1, field2 : 1 },{ unique:true })
but now I'm getting this trouble described below.Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment