-
Notifications
You must be signed in to change notification settings - Fork 1
chore: 몽고디비 셋업 #158
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
Merged
Merged
chore: 몽고디비 셋업 #158
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/depromeet/makers/config/MongoConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.depromeet.makers.config | ||
|
|
||
| import org.springframework.context.annotation.Bean | ||
| import org.springframework.context.annotation.Configuration | ||
| import org.springframework.data.mongodb.MongoDatabaseFactory | ||
| import org.springframework.data.mongodb.config.EnableMongoAuditing | ||
| import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver | ||
| import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper | ||
| import org.springframework.data.mongodb.core.convert.MappingMongoConverter | ||
| import org.springframework.data.mongodb.core.mapping.MongoMappingContext | ||
|
|
||
| @Configuration | ||
| class MongoConfig { | ||
| @Bean | ||
| fun mappingMongoConverter( | ||
| factory: MongoDatabaseFactory, | ||
| context: MongoMappingContext, | ||
| ) = MappingMongoConverter(DefaultDbRefResolver(factory), context).apply { | ||
| setTypeMapper(DefaultMongoTypeMapper(null)) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| spring: | ||
| application: | ||
| name: depromeet-makers-be | ||
| app: | ||
| token: | ||
| secretKey: ${TOKEN_SECRET_KEY} | ||
| expiration: | ||
| access: 86400 | ||
| refresh: 2592000 | ||
|
|
||
| --- | ||
| # MongoDB | ||
| spring: | ||
| data: | ||
| mongodb: | ||
| host: ${MONGO_HOST} | ||
| port: ${MONGO_PORT} | ||
| username: ${MONGO_USER} | ||
| password: ${MONGO_PASSWORD} | ||
| database: ${MONGO_DB} | ||
| field-naming-strategy: org.springframework.data.mapping.model.SnakeCaseFieldNamingStrategy | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 몽고디비는 snake_case를 사용해서 데이터 베이스에 스네이크 케이스로 역/직렬화 해주도록 하는 옵션입니다! |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기본 옵션은 직/역직렬화 할 class 정보를 DB에 저장하는데요, 패키지 정보를 굳이 저장하지 않아도 매핑이 가능해서 제거해주었습니다