Field names starting with underline is not supported
See original GitHub issueAccording 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:
- Created 4 years ago
- Comments:11 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@HosseinAgha : As a workaround for now i would provide a custom underlying name for the field like this:
id String @map("_id")
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-minglingid
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.