question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field names starting with underline is not supported

See original GitHub issue

According to the data modeling documentation data model field names can start with underline ([A-Za-z_][A-Za-z0-9_]*) but both prisma2 and prisma vscode extension throw error.
The underlined fields are very helpful when you need cross compatibility with MongoDB (e.g. _id)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
mavileincommented, Jul 31, 2019

@HosseinAgha : As a workaround for now i would provide a custom underlying name for the field like this: id String @map("_id")

1reaction
doronrkcommented, Aug 14, 2022

Hello @janpio, thanks for sharing the context on this. Perhaps it is just @dabrowne and my team, but this is definitely painful for our incremental adoption of Prisma. I’m surprised to hear that more people haven’t been impacted by this. My intuition is that most large applications using typescript & mongo would have tons of instances of ._id throughout. Co-mingling id and _id makes the migration to Prisma much more error prone.

I wonder whether this will become a more frequent issue as using Prisma with mongo becomes more popular.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What characters should not be used in ArcGIS for field names ...
Answer · Eliminate any characters that are not alphanumeric character or an underscore. · Do not start field or table names with an...
Read more >
Field name does not start with underscore - sonar issue
If the message says your field name should not start with an underscore, I'd suggest camelCase as per the Microsoft Guidelines. Share.
Read more >
Field names starting with `_`(underscore) are not matched ...
Hi, * wildcard does not match fields starting with _ in the query_string query. Example: Create Index with simple mapping: { "mappings": ...
Read more >
Field Names with leading underscore characters - The FMSoup
Regarding Q1, whether I use Field Names starting in _ or not, I always use custom functions to dynamically obtain the field names...
Read more >
object oriented - Declaring a field name starting with underscore
It depends on the language you use and on local conventions. For example, in C++ a leading underscore is in many cases reserved...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found