Imteyaz Ahmad
Imteyaz Ahmad

Reputation: 546

How to set Mongodb Field Naming Strategy in Spring boot

I am using spring boot 1.3.1.Release with Spring Data Mongodb and want to setup field naming strategy for fields. Below is my application.properties file:

spring.data.mongodb.uri=mongodb://localhost/test
spring.data.mongodb.field-naming-strategy=org.springframework.data.mongodb.core.mapping.SnakeCaseFieldNamingStrategy
spring.data.mongodb.repositories.enabled=true
spring.data.mongodb.database=test

Everything is working fine except the field naming strategy. Any help will be highly appreciated.

Upvotes: 2

Views: 3879

Answers (1)

user1211
user1211

Reputation: 1515

SpringBoot 1.3 has spring-data-mongodb version 1.8 and in this version of jar class with name SnakeCaseFieldNamingStrategy is not present.

Checked with the api docs here.. http://docs.spring.io/spring-data/mongodb/docs/1.8.0.RELEASE/api/

I guess u need to degrade the version of spring-data-mongodb to 1.5 or so. Probably this is the reason your Field naming strategy is not working.

Upvotes: 1

Related Questions