[ ] 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
Using the Prop() decorator, I cannot declare a TTL index using the expires field even if I'm using the raw() function. The issue does not occur if I declare the schema with the traditional way.
There are commented sections in src/cats.module.ts and src/cats.service.ts to test between with and without decorators. Start the application and check if the indexes are created using the mongo shell or MongoDB compass.
Environment
Nest version: 7.0.0
For Tooling issues:
- Node version: 14.4.0
- Platform: Windows
Others:
I'm submitting a...
Current behavior
Using the
Prop()
decorator, I cannot declare a TTL index using theexpires
field even if I'm using theraw()
function. The issue does not occur if I declare the schema with the traditional way.I believe it might have something to do with #413, as
CatSchema.obj
returns an empty object for the type ofexpiresAt
.Expected behavior
TTL index should be declared when using the
expires
field.Minimal reproduction of the problem with instructions
https://github.com/alexy4744/nestjs-mongoose-reproduction
There are commented sections in
src/cats.module.ts
andsrc/cats.service.ts
to test between with and without decorators. Start the application and check if the indexes are created using the mongo shell or MongoDB compass.Environment