问题
According to the Spring data mongodb documentation, the default behaviour of MongoTemplate is to not launch neither log any exception thrown by the underlying persistence layer (mongo driver).
In fact, the documentation says:
When in development it is very handy to either log or throw an exception if the com.mongodb.WriteResult returned from any MongoDB operation contains an error.
It is quite common to forget to do this during development and then end up with an application that looks like it runs successfully but in fact the database was not modified according to your expectations.
This decision may cause a lot of problems to new developers, who don't know how MongoTemplate is dealing with errors.
Shouldn't be better to set EXCEPTION as default value? In that case, only the developers who don't want to deal with any error will chante this value.
来源:https://stackoverflow.com/questions/35132938/why-is-writeresultchecking-set-to-none-by-default