-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Issue with createdAt immutability after updating to v6 #10807
Comments
Looks like the same (or similar) issue described here #10761 which seems to be fixed in mongoose 6.0.8. |
so i've updated to 6.0.8 and the problem still persists |
Actually, sorry. The person that submitted that defect was able to resolve the problem on their side so nothing was actually changed in mongoose to resolve it. |
Please advise how i can solve this problem. Looks like that issue also has the "bug" tag, so i assume this is a bug on mongoose's side? |
Modify the script below to demonstrate your issue const mongoose = require('mongoose');
const testSchema = new mongoose.Schema({ name: String, age: Number}, {timestamps:true});
const Test = mongoose.model('Test', testSchema);
async function run() {
await mongoose.connect('mongodb://localhost:27017/', {useNewUrlParser: true,
useUnifiedTopology: true,});
await mongoose.connection.dropDatabase();
await Test.create({name: 'a', age: 1});
await Test.create({name: 'b', age: 2});
await Test.create({name: 'c', age: 3});
console.log(await Test.find())
}
run(); |
i'm using discriminator with timestamps: true in nestjs (via nestjs/mongoose package), and got the following error |
@vtrphan you do need to specify Without a code sample that demonstrates this issue, we're unlikely to be able to fix this issue. |
@vkarpov15 i have tried to recreate the issue. It can be found here. Please open a new terminal and run with yarn start. Then comes the error |
I took a closer look and the issue is that you need to do We fixed this issue in b21a3d2, and will ship the fix in v6.0.13. In the meantime, just use |
@vkarpov15 thank you for the advice. Had it working now. Thanks for your fix. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I'm getting this error after updating to v6
TypeError: Invalid schema configuration: Trueis not a valid type at pathcreatedAt.immutable. See http://bit.ly/mongoose-schematypes for a list of valid schema types.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
I expect no error just like the case with v5
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: 14
Mongoose: 6.0.8
Please help
The text was updated successfully, but these errors were encountered: