Why is WriteResultChecking set to NONE by default?

心已入冬 提交于 2019-12-10 17:33:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!