DB/MongoDB

mongoDB 에 json 값 저장하기 ( spring )

벨포트조던 2020. 1. 6.
반응형

https://stackoverflow.com/questions/29656128/how-can-a-store-raw-json-in-mongo-using-spring-boot

 

How can a store raw JSON in Mongo using Spring Boot

I'd like to take HTTP PUT request with JSON and store it unmodified in Mongo. How can I do this? The best I have is this: @RestController public class ConfigurationController { @Autowired

stackoverflow.com


Document doc = Document.parse(jsonString);

// 여기에 추가하려면 .append("registerdate", new Date()); 이런식으로 

mongoTemplate.insert(doc, "foo");

 

 

반응형

댓글