[JAVA-2615] Snake Case Created: 27/Sep/17 Updated: 11/Sep/19 Resolved: 08/Nov/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | POJO |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial - P5 |
| Reporter: | Aleksandr Blokh | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDB java driver |
||
| Attachments: |
|
| Backwards Compatibility: | Fully Compatible |
| Description |
|
Hi, guys! Struggling trying to find a default naming strategy config and seems like it just not there. So if it's possible - would be very grateful for smthing like .setNamingStrategy(NamingStrategy.SNAKE_CASE.. Thx |
| Comments |
| Comment by Ross Lawley [ 05/Oct/17 ] | ||
|
Hi alex.blokh, This would be easier to do with your own custom convention. Custom Conventions can easily be set globally via the PojoCodecProvider.Builder.conventions(conventions) method. See the conventions documentation. The PojoCustomTest case has an example of a custom convention that looks like it could suit your needs. Just don't forget to also include the default conventions. I hope that helps, Ross | ||
| Comment by Aleksandr Blokh [ 04/Oct/17 ] | ||
|
Yes, I'm talking about field names in documents Now, if I have a camelCase field name in java -> it goes the same camelCase key name to a mongodb document
For example Jackson library has ObjectMapper with a
It's fairly straightforward. If that's possible with a convention it would be very helpful to write a snippet in documentation on that. Cause I found nothing on stackoverflow about that Thanks a lot, guys! | ||
| Comment by Ross Lawley [ 28/Sep/17 ] | ||
|
Hi alex.blokh, Please could you add some context to the ticket, I'm unclear as to what exactly you are asking for. If it's regarding field names in Documents then they are set on insertion. If this is regarding the POJO Codec then you should add a custom convention to change the read and write property names to the format you require. All the best, Ross |