-
Notifications
You must be signed in to change notification settings - Fork 41
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
MongoDB: Quick fix for missing @map("_id")
annotation
#762
Comments
@matthewmueller do you think this should be prioritized for mongo GA? |
I could see this being a nice-to-have for sure. It seems that people like that our formatter auto-writes back-relations. I could see us extending that concept here as well. Some ideas: Scenario 1: You're using the Before (cursor is |): model User {
id String @id|
firstName String
} I could see this auto-writing the following: model User {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId|
firstName String
} Of course, if you edit any of this, it doesn't try to re-correct. It only adds under the conditions above, it never changes, deletes, or duplicates. I assume there's some element of playing around with it until it feels right. Scenario 2: You're using the Before (cursor is |): model User {
id Int @id|
firstName String
} I could see this auto-writing the following: model User {
id Int @id @map("_id")|
firstName String
} Again, we'd need to be conservative about when we auto-write. Added as a nice-to-have to the epic. |
Note: Hitting save does not do anything by default, you need to manually configure VSCode to run "format on save". |
@map("_id")
annotation with mongo@map("_id")
annotation
The text was updated successfully, but these errors were encountered: